javascript - jquery 1.9.1 on event not working -


with jquery v1.5.2 following function works, have upgraded jquery 1.9.1 live has been replaced on function. if change live on. not working.

i changed on live , included migration plugin working. how can use on function

$( ".pop-up" ).live(                         "click",                             function( event ){                                 // id of item clicked on                                 var id = $(this).attr('id');                                  alert(id)                             // block href working                             return( false );                              }); 

try this

instead of document use selector exists in dom, if element added dynamically dom @ later time.

$(function(){       $(document).on("click", ".pop-up",         function( event ){                             // id of item clicked on                             var id = $(this).attr('id');                              alert(id)                         // block href working                         return( false );        });  }); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -