why my Button B does not show alert popup?
Below is my codes inside separate files
.html:
<html>
<body>
<input type="button" class="popup" value="BUTTON A"/><br>
<input type="button" class="displaymeh" value="SHOW"/>
<div id="display">
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="script.js"></script>
</body>
</html>
.php:
<?php
echo "<input type='button' class='popup2' value='BUTTON B'/>";
?>
.js:
$(".popup").on('click', function(){
alert("HELLO WORLD!");
});
$(".popup2").on('click', function(){
alert("HELLO WORLD! 2");
});
$(".displaymeh").on('click', function(){
$.ajax({
url: 'display.php',
success: function(data) {
$('#display').html(data);
}
});
});
The reason I place the button inside .php, because I'm planning to display database table inside the php and the button to manage the database such as delete.
Edit: No, this is not the same with the Difference between .on('click') vs .click() and why I already have negative downvote within 1 hour, I will never know.