jQuery: Get all text inputs where no type is defined
问题 When i use $("input[type=text]") i absolutely mean all text boxes but it only return inputs that type has been set for them. For example in: <input name="text1" /> <input name="text2' type="text"/> text1 is not included. how to get all text inputs regardless type has been set or not ? 回答1: Selects the ones with type=text, and the ones without type attribute. $("input[type=text],input:not([type])") 回答2: $('input:text') From the official documentation: As of jQuery 1.5.2, :text selects input