[英]Select dom elements by attributes having array like attributes
I have many elements that are structured to get them in array like mapping on server side. 我有许多元素被构造成将它们放在数组中,就像服务器端的映射一样。
<input type="CHECKBOX" id="478" value="1" name="data[GroupInfo][student][478]" onclick="return updateValues('478')">
<input type="CHECKBOX" id="490" value="1" name="data[GroupInfo][student][490]" onclick="return updateValues('490')">
<input type="CHECKBOX" id="478" value="1" name="data[ClassInfo][student][478]" onclick="return updateValues('478')">
<input type="CHECKBOX" id="490" value="1" name="data[ClassInfo][student][490]" onclick="return updateValues('490')">
so on... Now, I want to select them using their name attribute like 所以......现在,我想用他们的名字属性来选择它们
$("[name^=data[ClassInfo][student]]");
but this won't work I tried to escape barckets to. 但这不起作用我试图逃离barckets。
$("[name^=data\[ClassInfo\]\[student\]]");
but no luck; 但没有运气;
I want to select them using name attribute. 我想使用name属性选择它们。
尝试这个:
$("[name^='data[ClassInfo][student]']");//Wrap in the single quotes
$('input[name*="data[ClassInfo][student]"]') // matches those that contain 'data[ClassInfo][student]'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.