Reputation: 6758
I am trying to select an element as below
$('a[href^="#Images_Tab"]')
This works fine however what actually need is this that the value of href is dynamic and I need to change the statement something like below;
$('a[href^="+hrefVal+"]')
I know this statement wrong as I have already tried it.
Any suggestion?
Upvotes: 2
Views: 54
Reputation: 1296
You aren't closing your string prior to concatination, you need to do something like
$('a[href^="'+hrefVal+'"]')
Upvotes: 0
Reputation: 67207
Use single quotes instead of double quotes,
Try,
$('a[href^="' + hrefVal + '"]')
Upvotes: 2