jquery - How do I make permanent changes to javascript variables or html elements inside of .click()? -


for example:

$(document).ready(function(){     $('#submit').click(function(){         $('#rightad').text("hello everybody");     }); }); 

this changes text in #rightad moment button clicked. how make remain, "hello everybody" after click ends? or thinking wrong way?

changing via script reflect until page gets refreshed.

try this:

html:

<div id="rightad"> text.....</div> <button id="submit">submit</button> 

jquery:

    $('#submit').click(function(){     $('#rightad').text("hello everybody"); }); 

if using <input type="submit"/> submit page, changes flashed page gets refresh.

use event.preventdefault() prevent form submission


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -