Answer the question
In order to leave comments, you need to log in
How to apply a method to two jQuery variables at once?
The question is, there are two variables
var $name = $('#usrname'),
$email = $('#email');
$name.hide()
$email.hide()
Answer the question
In order to leave comments, you need to log in
Based on your condition, the problem is solved in this way:
[$name,$email].map(function(item) {
item.hide();
})
In your case - best practice would be $('#usrname, #email').hide()
More info here: https://api.jquery.com/multiple-selector/
Was happy to help :)
I'm not very special, but it won't work like that?
var $form = $('#usrname, #email')
$form.hide()
And to register the same class on the elements and do so?$(".classname").hide();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question