这应该很容易。如何通过按钮的值查找按钮(Jquery选择器)
我有这个HTML:这应该很容易。如何通过按钮的值查找按钮(Jquery选择器),jquery,jquery-selectors,Jquery,Jquery Selectors,我有这个HTML: <div id='grid'> <input type="button" value="edit"/> <input type='button' value='update'/> </div> 但它会显示两个按钮的警报。我知道我一定在做傻事。非常感谢您的帮助 感谢Kobi&Sarfraz对我的帮助。下面给出了正确答案。 $("input[value='update']").click(function(){alert('tes
<div id='grid'>
<input type="button" value="edit"/>
<input type='button' value='update'/>
</div>
但它会显示两个按钮的警报。我知道我一定在做傻事。非常感谢您的帮助
感谢Kobi&Sarfraz对我的帮助。下面给出了正确答案。
$("input[value='update']").click(function(){alert('test');});
试试这个:
$("input[value='update']").click(function(){alert('test');});
根据,在jQuery中,在引用属性时不应使用
@
。jQuery使用CSS选择器,要选择它,不应在CSS中使用@
。它不起作用。现在,它不会同时显示这两方面的警报。
$("input[value='update']").click(function(){alert('test');});