如何选择包含“名称”属性的元素?元素具有名称属性元素的jQuery选择器
例子:
<select id="itemPK.country.id_id" name="itemPK.country.id"><option value="7">India</option><option value="8">Malaysia</option></select>
<input id="point_id" name="point" type="number" value="">
如何选择包含“名称”属性的元素?元素具有名称属性元素的jQuery选择器
例子:
<select id="itemPK.country.id_id" name="itemPK.country.id"><option value="7">India</option><option value="8">Malaysia</option></select>
<input id="point_id" name="point" type="number" value="">
$('[name]')
试试这个,你可以得到一个具有名称
的attribute selectors是你所需要的所有元素:
$('input[name="point"]')...
$('[name="something"]') //In case it's not specifically an <input> element
好运
编辑:我看到,您可能要求包含某个属性的元素,而不是在name属性中包含X值的元素。 PSR提供的答案是要走的路。 This是“有属性”选择器的文档。
$("*[name='point']")