JQuery bind() method not working -
i make code ajax give me pagination bar <a href="" class="page-navi page--4">4</a>
example. bind , alert not working. why?
<script ... > $(function() { $(".page-navi").bind("click",function() { alert("!!!"); }); $.ajax( { url: "some url", type: "get", success:function(data, status, jqxhr) { $("#pagination").html(data); }, error: function (request, status, error) { console.log(request.responsetext); } }); }); </script>
it looks calling ajax method update #pagination element after loading.
if .page-navi element inside #pagination element event handler attached via bind wiped out.
move inside ajax success.
Comments
Post a Comment