I need a sort of “live” effect on some checkbox – I need that every checkbox since now will be checked by a jQuery function attr("checked", true) when they appear.
Is it possible to do?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do this in your
$.ajax()successhandler, or thesuccesshandler of whatever short form of$.ajax()you’re using, (e.g.$.post(),$.get(), etc.), like this:This is the most optimal way to accomplish what you’re after, by giving it a context to look in…so it’s only looking for
input:checkboxin the returned result you’re now adding to the DOM, not the entire page.If that’s not possible, you can use something like the livequery plugin, like this:
This is more expensive due to the way it looks for new elements to be added, but gets the job done.