Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery .on() not working

I have the following:

<input type="submit" id="submit" value="Submit" />

Inside of jQuery I have have the following:

<script type="text/javascript">
$(document).ready(function () {
    $("#submit").on("click", function () { 
        alert('test');
    });
});
</script>

This doesn't work. I am using IE9.

Might anybody know which version of Jquery is supporting .on()?

like image 435
Nate Pet Avatar asked Jul 11 '12 18:07

Nate Pet


1 Answers

Use this version of on

$(function(){
   $(document).on("click","#submit", function (e) { 
    //e.preventDefault();  // if you want to prevent default form submission
     alert('test');
   });
});
like image 194
Shyju Avatar answered Oct 16 '22 04:10

Shyju