This should be real easy. How to find a button through its Value (Jquery Selector)
Posted
by Raja
on Stack Overflow
See other posts from Stack Overflow
or by Raja
Published on 2010-04-21T12:23:22Z
Indexed on
2010/04/21
12:33 UTC
Read the original article
Hit count: 166
jQuery
|jquery-selectors
I have this HTML:
<div id='grid'>
<input type="button" value="edit"/>
<input type='button' value='update'/>
</div>
How to I attach a click event only to Update button. I know I could add a class to it or specity an id but both are not possible since it is in gridview.
I tried this:
$("input:button[@value='update']").click(function(){alert('test');});
but it displays an alert for both buttons. I know I must be doing something silly. Any help is much appreciated.
Thanks Kobi for helping me out. Given below is the right answer.
$("input[value='update']").click(function(){alert('test');});
© Stack Overflow or respective owner