I would like to know how to select elements using variables. What I tought would work was:
var class = "help-hu" // this value can change to "help-en" and "help-de" as well
$("."+class).fadeIn('slow');
But it doesn’t work. Any workaround?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you check your
browserconsole you will see this:That means that you don’t have to use this kind of words because they are
reserved!You can try another one and use the same logic like this…
Example:
This will work without problems.