How to choose the right input, the type of which is equal to text, email or tel, and if it is equal to redio or checkbox, it is unnecessary to take?

$(".el input[type='text|email|tel']:first").val(); 

Is it right?

  • Doesn't work, already checked - Vladimir

1 answer 1

Looks like a crutch

 var a = $('input[type="text"]:first, input[type="email"]:first, input[type="tel"]:first').val(); console.log(a); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="el"> <input type="checkbox" value="3"> </div> <div class="el"> <input type="text" value="4"> </div> <div class="el"> <input type="email" value="1"> </div> <div class="el"> <input type="tel" value="2"> </div> 

  • Thank you, I did not think of simplicity myself) - Vladimir