Attach event to results of a JQuery $.get call -


i getting list of checkboxes $.get call in jquery. there anyway can attach onclick function each of these checkboxes within parent page.

e.g. parent page contain following code (maybe errors have wrote off top of head , not tested it)

$(document).ready(function(){   $(":checkbox").click(function(){     //do stuff   }    $.get('some-url.html', function(data){     $('checkbox-holder').html(data);   }); } 

therefore results returned 'some-url.html' automatically have onclick event

thanks

using $.live() set information cause dynamically-loaded elements act in same manner. set once @ top of script, , rest of work. don't need reference when ajax requests or anything.

$(":checkbox").live("click", function(){   // want them do? }); 

Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -