私が使用するとき、私は$("input[type=text]")
絶対にすべてのテキストボックスを意味しますが、タイプが設定されている入力のみを返します。
例:
<input name="text1" />
<input name="text2' type="text"/>
text1
含まれていません。
タイプが設定されているかどうかに関係なく、すべてのテキスト入力を取得する方法は?
私が使用するとき、私は$("input[type=text]")
絶対にすべてのテキストボックスを意味しますが、タイプが設定されている入力のみを返します。
例:
<input name="text1" />
<input name="text2' type="text"/>
text1
含まれていません。
タイプが設定されているかどうかに関係なく、すべてのテキスト入力を取得する方法は?
type=text のものと、type 属性のないものを選択します。
$("input[type=text],input:not([type])")
$('input:text')
jQuery 1.5.2 以降、:text は指定された type 属性を持たない入力要素を選択します (この場合、type="text" が暗示されます)。
filter
次の方法を使用できます。
$("input").filter(function(){
return this.type === 'text'
})
If you don't set the type, then [type="text"] will preclude the ones without type.
if you select $('input') you will get every input regardless of type, so that could be a text field, or not. but it would still apply to every input field.
If you don't set the type, it won't be shown as type=text, but it will be rendered as such. That means you can't select JUST [type="text"], but you could always preclude others though as follows:
$('input[type=text]','input:not([type])')
Not sure if this helps at all.
入力のすべての名前に「テキスト」が含まれている場合 (そうでない場合、それがテキスト ボックスであることをどのように理解できますか?)、試すことができます。
$('input[name*="text"]');