Reputation: 31
I would like to add a variable in an href so that it looks like, or behaves like, this:
var user = "YourName";
$("#main-container .profile-link[href='/home/user/' + player + '/']")
I'm hoping to be able to select all the users that I have in that variable.
Upvotes: 0
Views: 47
Reputation: 388316
Use proper string enclosures
$('#main-container .profile-link[href="/home/user/' + player + '/"]')
In your case since the string literal is started using "
you need to use the same to close the string before the variable is concatenated like "#main-container .profile-link[href='/home/user/" + player + "/']"
Upvotes: 2