当用户选择一个选项时,我需要启用提交按钮,这是一个动态数据。我的 HTML:
<form method="post" action="xxx" id="member">
<tr>
<td>1</td>
<select name="status">
<option value="a">aktif</option>
<option value="l">terkunci</option>
<option value="b" selected="b">blokir</option>
</select>
</td>
<input type="hidden" name="update_buyer" value="TRUE" />
<input type="hidden" name="id" value="1" />
<td>
<button role="button" data-toggle="modal" data-target="#modal" class="btn btn-danger delete">Delete</button>
<input type="submit" class="btn btn-primary save" disabled="disabled" value="Save">
</td>
</tr>
</form>
<form method="post" action="xxx" id="member">
<tr>
<td>2</td>
<td>
<select name="status">
<option value="a" selected="a">aktif</option>
<option value="l">terkunci</option>
<option value="b">blokir</option>
</select>
</td>
<input type="hidden" name="update_buyer" value="TRUE" />
<input type="hidden" name="id" value="2" />
<td>
<button role="button" data-toggle="modal" data-target="#modal" class="btn btn-danger delete" data-email="tess@email.com">Delete</button>
<input type="submit" class="btn btn-primary save" disabled="disabled" value="Save">
</td>
</tr>
</form>
我试试
$('select').change(function(){
$('.save').removeAttr('disabled');
}
但它启用所有提交按钮,我只想启用哪个用户点击,而不是所有提交按钮。
也许喜欢
$('select').change(function(){
$(this).parent('form').find('.save').removeAttr('disabled');
}
但它不起作用:(我该怎么做?帮助......