I got this problem about all night. I will click button and I got nothing data or alert. Please help me. And so Sorry for my bad English.I'll try to learn.
$(document).ready(function() {
$("#test-click").on("click",function() {
alert('1');
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button type="button" id="test-click">testClick</button>
Yes OfCourse! your code is not working. because .on()
event comes after jquery 1.7.x versions. Please use .live()
event instead of .on()
event. Or else use latest jquery version.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#test-click").live("click",function(){
alert('1');
});
});
</script>
<button type="button" id="test-click">testClick</button>