var $inputs = $('.add-item-form :input');
This gets all the input fields but also picks up the select fields which I do not want.
e.g.
<select><option>example</option></select>
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.
:inputis a jQuery-specific pseudo-selector forinput,textarea,button, andselectelements. So you could do this:…but you can also just call out specifically what you want:
…which would have the advantage that if the browser supports
querySelectorAll(and nearly all do, in standards mode), jQuery can just hand off to native handling (whereas:inputis specific to jQuery, so can’t be handled by the browser’s native stuff).Or, of course, if you don’t want
textareaandbuttonelements, it’s really simple:…and again that has the advantage of being handled by the browser’s optimized stuff where possible.