jquery - How to keep a value unchanged? -



jquery - How to keep a value unchanged? -

this basic question, but...

<div id="caption">323</div> var = $("#caption").html();

now, content of #caption changed...

and need starting value (323)

alert (a);

but result new value.

how can maintain starting value unchanged ?

var old=$('#caption').html(); $('#sub').on('click',function(){ $('#caption').html('525'); alert(old); });

demo

jquery

Comments

Popular posts from this blog

ruby on rails - Devise Logout Error in RoR -

model view controller - MVC Rails Planning -

php - Working with pretty urls on apache and fastcgi after hhvm installation -