javascript - How to Avoid Class Conflicts in jQuery -
in code generate dynamic divs according our requirement number of appointments per day. our main requirement on mouseover, fetch details of patient particular encounter..
my html follows
<div class="schediv" id="1"></div> <div class="schediv" id="2"></div> <div class="schediv" id="3"></div>
and jquery written follows
$('.schediv').mouseover(function() { var id = $(this).attr('id'); alert(id); ------- );
it works fine single div doesn't work multiple divs.
you need use .on()
because addind dom dynamically.
$(document).on('mouseover','.schediv',function(){ //code goes here });
Comments
Post a Comment