[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

how to set a variable on a jquery filter?

Posted on 2011-10-08
4
Medium Priority
?
380 Views
Last Modified: 2012-05-12
how to set a variable on a jquery filter? This is not working.

var setHighLight = "last";

$("#ul_b li:(' + setHighLight +')").addClass('highlight');
0
Comment
Question by:areyouready344
  • 3
4 Comments
 
LVL 83

Expert Comment

by:leakim971
ID: 36937201
$("#ul_b li:' + setHighLight).addClass('highlight');
0
 
LVL 83

Accepted Solution

by:
leakim971 earned 1000 total points
ID: 36937203
correction : $("#ul_b li:" + setHighLight).addClass('highlight');
0
 

Author Closing Comment

by:areyouready344
ID: 36937239
thanks Leakim, its now working.
0
 
LVL 83

Expert Comment

by:leakim971
ID: 36937359
var third = 2;
$("#ul_b li:eq(" + third + ")").addClass('highlight');
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
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

831 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