1

I have the following:

var x = '.'+this.id;  

and this does not work:

$(x,'#thumb').show();

but this does:

$(x).show();

and obviously so does this:

$('#thumb').show();

What am I missing? Should I be doing something else in general to pass variables (even on their own) through jQuery?

3
  • 2
    string concatenation? myVar + "my string" Commented Aug 13, 2010 at 4:38
  • Well, $(x + '#thumbs').show() doesn't work. $(x+', #thumbs').show() works fine. But it looks so sloppy. Commented Aug 13, 2010 at 4:45
  • Too bad jquery can't read minds, why didn't creators think of that? :) Commented Aug 13, 2010 at 4:46

1 Answer 1

2

You need to concatenate the two strings together:

$(x+',#thumb').show();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.