JQuery events don't work with ASP.NET MVC Partial Views JQuery events don't work with ASP.NET MVC Partial Views ajax ajax

JQuery events don't work with ASP.NET MVC Partial Views


I have found a solution :

Juste try to make :

$(document).on("click", "YOUR_SELECTOR", function(e){  /// Do some stuff ...});

Instead of :

$("YOUR_SELECTOR").on("click", function(e){  /// Do some stuff ...});


The easiest way to handle this would be to utilize the live() method:

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


<script>   $(document).ready(function(){      $("input[id^=button]").live('click', function() {                //Your Code         }); });</script>