1
我有一个脚本允许我将值粘贴到不同的输入中。在jQuery中按名称[]过滤输入
<input name="BOO_Price">
<a id="repeatPrice">Repeat</a>
<input name="BOO_Price">
<input name="BOO_Price">
<input name="BOO_Price">
<input name="BOO_Price">
$('#repeatPrice').on('click', function(e) {
e.preventDefault();
var price = $(this).prev('input').val();
$('input[name=BOO_Price]').val(price);
});
它完美地工作。
但现在我的输入形式是这样的。
<input name="BOO_Price[]">
但是,这是行不通的:
$('input[name=BOO_Price[]]').val(price);
理想情况下,我不希望有一些id
或其他形式的classes
。
你能帮忙吗?