jQuery reload the DOM? -


i have page has button on it. when user clicks button dynamically render's form (ie it's not showing hidden form.. it's creating using jquery).

my issue newly created form doesn't respond jquery commands. code have rendered form @ moment.

$("#savenewlang").click(function(e) {     console.log("savenewlang has been clicked"); }); 

so should console.log when click submit button it's not running.

any idea how reload dom or assign actual event correctly fires?

$("#container").on('click', '#savenewlang', function(e) {     console.log("savenewlang has been clicked"); }); 

here #container points parent element of #savenewlang belongs dom @ page load.


to specify event .on() need three arguments

.on(eventname, target, callback); 

but ordinary binding needs two arguments

.on(eventname, callback); 

read more .on()


remainder

put of code within

$(document).ready(function() {  }); 

in short

$(function() {  }); 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -