That looks like the proper syntax to get your desired selector. Are you getting an error or unexpected results?

-- Josh

----- Original Message ----- From: "Shadi Almosri" <[EMAIL PROTECTED]>
To: "jQuery (English)" <jquery-en@googlegroups.com>
Sent: Monday, October 13, 2008 9:32 AM
Subject: [jQuery] JQuery Selector and Java Script Variable



Hiya,

I've not been able to find an answer to this online! can someone point
out the correct syntax for this:

var myRel = $(this).attr("rel");
var largePath = $('a[rel*=' + myRel +']').attr("href");

Basicly the myRel gets set correctly, but how do i use the javascript
variable as part of the jquery selector so that i can get a selector
that looks like:

(assuming myRel was 5)...

var largePath = $('a[rel*=5]').attr("href");

Thanks in advance!

Shadi

Reply via email to