You can use jQuery val() function to retrieve buttons' value as shown below.
HTML
<button class="btn1" name="btn1" value="button1">
Label</button>
JavaScript
This will display the value button1.
Regards,
Samitha
HTML
<button class="btn1" name="btn1" value="button1">
Label</button>
JavaScript
<script type="text/javascript">$(function() { $('.btn1').click(function() { alert($(this).val()); }); });</script>
This will display the value button1.
Regards,
Samitha
No comments:
Post a Comment