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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -