javascript - Issues with .on() and AJAX -



javascript - Issues with .on() and AJAX -

this question has reply here:

event binding on dynamically created elements? 13 answers

i have these lines in header

$( document ).ready(function() { $(".thumb").hide(); $(".thumb").first().show(); $(".text" ).mouseenter(function() { $(this).prev(".thumb").show(); }).mouseleave(function() { $(this).prev(".thumb").hide(); }); });

they work fine on page load, i'm loading new html content ajax, these lines beingness ignored.

in previous questions, gentle person told me utilize .on() okay. how apply .on() code above?

i know it's dumb question of you, i'm absolute beginner , i'd appreciate it, if give helpful advice.

your code (open modifications)

$(document).ready(function() { $(".thumb").hide(); $(".thumb").first().show(); $(document).on('mouseenter',".text",function(){ $(this).prev(".thumb").show(); }) $(document).on('mouseleave',".text",function(){ $(this).prev(".thumb").hide(); }) });

javascript jquery ajax

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -