mercredi 23 décembre 2015

On change of any checkbox inside a div trigger a function

Let's say there are multiple checkboxes inside a div (call it "startwars" ) i know how to check and trigger a function if state of checkbox is changed or clicked on all over the page by doing :

$('input[type=checkbox]').click(function() {
    console.log("somethign is checked on the page")
});

but what if i want to limit that scope to a div and check if any of checkbox state is changed/clicked which are inside that a div,

I want to trigger a function if any of the checkbox is changed/clicked inside a div element with JQuery




Aucun commentaire:

Enregistrer un commentaire