When I click button A, I want it to modify the onClick action of a Done button.
Here’s the done button:
<a href="#" class="btn" data-dismiss="modal" class="done-btn">Done</a>
After I click button A, this code is executed (the alert “A” pops up):
<script type="text/javascript">
$(document).ready(function() {
// make the items table reload when the dismiss button is clicked
alert("A");
$(".done-btn").on(function() {
alert("Done button clicked.")
});
});
</script>;
I have also tried click(), onclick =, and removing the $(document).ready wrapper.
You have two class= in your html. Simplify it to:
Change your javascipt to: