如何通过类名和值来定位特定输入?
<input type="checkbox" class="something" value="1">
<input type="checkbox" class="something" value="2">
<input type="checkbox" class="something" value="3">
目标类名+值2:
$('target classname = something, value = 2').prop('checked', true);
最佳答案
$('input[class=something][value=2]').prop('checked', true);
$('input[class=something][value=2]').prop('checked', true);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="checkbox" class="something" value="1">
<input type="checkbox" class="something" value="2">
<input type="checkbox" class="something" value="3">
关于javascript - 带有类名和值的目标输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48976893/