如何单击基于数据代码值的单选按钮?
<input name="shipping_method" type="radio" value="freeshipping_freeshipping" id="s_method_freeshipping_freeshipping" class="radio" data-code="Free">
<input name="shipping_method" type="radio" value="freeshipping_freeshipping" id="s_method_freeshipping_freeshipping" class="radio" data-code="Sale">
最佳答案
您可以使用输入属性来执行此操作。
例如,请参阅下面的代码。
$(document).ready(function(){
$("input[data-code = 'Free']").click(function(){
alert("hi");
});
});
关于javascript - Jquery点击带有键值的元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32735203/