javascript - JQuery on click table button -


i have table in each tr has button:

<td class='id'><input type='button' class='thisbutton' value='this'></td> 

in page, define action when there's button click. tried this:

$('.thisbutton').click(function() {     alert("a"); }); 

nothing happens. doing wrong. simple not work :-(

if correctly include jquery, , script, should work fine. comments have suggested, check console errors give hint problem. it's core part of script debugging.

here's doc showing how use console in chrome: https://developer.chrome.com/devtools/docs/console

and firefox counterpart in case helps: https://developer.mozilla.org/en/docs/tools/web_console

here's fiddle showing in action: http://jsfiddle.net/td4go6t9/

and source it;

markup:

<table> <tr>     <td class='id'><input type='button' class='thisbutton' value='this'></input></td>     <td class='id'><input type='button' class='thisbutton' value='this'></input></td>     <td class='id'><input type='button' class='thisbutton' value='this'></input></td> </tr> 

script:

    $(function(){         $('.thisbutton').click(function() {             alert("a");         });      }); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -