Nandagiri Akhilesh Nandagiri Akhilesh - 6 months ago 21
HTML Question

Calling onmouseover function multiple times

I have multiple div's and I have a unique code for each div and whenever a user comes across a specific div I want only that div to be counted.

My problem is if I use onmouseover-html then the function which is triggered is running multiple times.

There are posts which suggest using mouseenter-jquery thing but If I use mouseenter-jquery I don't know how to get the unique code of div's.

I tried onmouseover and server got too busy and failed.

$('sample').mouseenter(function(this){
var sample = $("#sample input.sam").val();
document.write(sample);
});

Answer

Try this

$('some-div').mouseenter(function(){ 
    console.log(this); 
    console.log($(this)); 
});
Comments