This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes JQuery Hover function syntax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JQuery Hover function syntax" Watch "JQuery Hover function syntax" New topic

JQuery Hover function syntax

Tarik Ansari
Ranch Hand

Joined: Dec 31, 2008
Posts: 50
Hi All,

I am new to JQuery and need a requirement of hover using css. I have the snippet which does the job but inorder to avoid code duplication i came up with a snippet for which facing issue with the syntax.

My Snippet with syntax issue:

Actual Snippet:

Just add 1,2,3 to .bu is the only requirement. i tried with for loop but facing issue with syntax.

Please help me


Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
Why would you give them all separate classes? Give them all the same class and use this inside the object to work with the link.

Tarik Ansari
Ranch Hand

Joined: Dec 31, 2008
Posts: 50
Hi Eric,

The reason why i needed bu1,bu2,bu3 is if i use common bu1 for the ahref, all are highlighted as a part of hover function. So thought i can have bu1,bu2 etc

But using of 'this' eliminates the necessity of individual bu1,bu2,bu3 etc

Hence, code works.

Thanks for the help


Consider Paul's rocket mass heater.
subject: JQuery Hover function syntax
Similar Threads
Dblclick and Click event handlers not invoked - used jQuery
jQuery selector using array of objects
Is it possible to put a button inside autocomplete in jquery ui plugin?
jQuery- Verify I selected right element and i am unable to remove it?
doubt about loading classes