Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

how to get the index of  an li element that is highlighted using jquery?

Posted on 2011-10-07
5
Medium Priority
?
348 Views
Last Modified: 2012-05-12
how to get the index of  an li element that is highlighted using jquery? I tried this but not working.

alert("Has Class: " + $("#list li").hasClass('highlight').index());
                        
What I mean by highlighted is that the li element has a class called highlight when I hover over it or by default.
0
Comment
Question by:areyouready344
  • 3
  • 2
5 Comments
 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 36931444
0
 
LVL 20

Accepted Solution

by:
chaitu chaitu earned 1000 total points
ID: 36931485
$("#list li.highlight").index();
0
 

Author Comment

by:areyouready344
ID: 36933889
thanks chaituu, I will give it a try...
0
 

Author Comment

by:areyouready344
ID: 36934517
thanks chaituu for understanding the question and providing the correct solution.
0
 

Author Closing Comment

by:areyouready344
ID: 36934522
this was an excellent solution...
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question