apply css class onmouseover and remove onmouseout using javascript

Recommended Answers

All 2 Replies

what is your specific question?
well if i could undestand the question
here a sample code:

<!DOCTYPE html>
function bigImg(x)

function normalImg(x)

<img onmouseover="bigImg(this)" onmouseout="normalImg(this)" border="0" src="smiley.gif" alt="Smiley" width="32" height="32">

<p>The function bigImg() is triggered when the user moves the mouse pointer over the image.</p>
<p>The function normalImg() is triggered when the mouse pointer is moved out of the image.</p>


If you just want to toggle classes on mouse onmouseover and remove you can use something like this with jQuery :

$(element).hover(function(){ $(this).classToggle('name_of_the_class');}});
you can do the same on function on mouse leave or blurr etc.

Hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.