1

Based upon a checkbox, I pop a jquery UI dialog box. The content of the dialog box is dynamically built from a db. Each row has a check box for selection.

I'd like to trigger additional functionality based on clicking one of the check boxes. In the dynamically created table, each check box has a class of "promoteSelect".

Here's the code I have for the jQuery side of things.

// Handle selecting rows from Promotion Sheet Selection Table
$(".promoteSelect").on("change", function() {
    if(this.checked) {
        var env = $("#selectedEnv").val().toUpperCase();
        var promo_key = $(this).val();
        alert(promo_key);
        buildRepoTable(promo_key, env);
    }
});

Any ideas?

** UPDATE ** Figured it out. I had to change my container and selector.

$('#higherDiv').on('change', '.promoteSelect', function(){});
  • each checkbox have unique ids ? Please show an html sample and your desired output. – Pedro Lobito Apr 29 '15 at 15:06
  • 2
    What does not work in your code? [Event binding on dynamically created elements?](http://stackoverflow.com/q/203198/3639582): if the checkboxes are dynamic and your click event does not work. – Shaunak D Apr 29 '15 at 15:06

0 Answers0