My code is below:
<div id="action-buttons" class="container">
<button type="button" name="MyButton" id="closeButton">close RMA</button>
</div>
<div>
<button type="button" id="refreshButtons">refresh Buttons</button>
</div>
<script type="text/javascript">
$(document).ready(function () {
$("#refreshButtons").on('click', function () {
$.ajax({
url: "/renderButtons.html",
error: function () {
alert('Error message');
},
success: function (HtmlResult) {
$("#action-buttons").html(HtmlResult);
},
complete: function() {
alert('Action buttons - loaded successfully');
}
});
});
$("#closeButton").on('click', function () {
alert('some text');
});
});
</script>
When i click on #closeButton
I see the Alert. That's correct.
But when I load the div#action-buttons
content (by clicking #refreshButtons
) my alert doesn't show. Why?
Why there is no message in browser console?.
"/renderButtons.html" is simply html file:
<button type="button" name="MyButton" id="closeButton">close RMA</button>