Getting text of a table element. [HTML, CSS, Javascript, JQuery] -
i've been experiments code , can't seem work. i'm trying make can alert text of element when click nothing alerting, link project below. code put in. link project: http://jsfiddle.net/enmydky4/
code if don't want go link:
html <body> <table id="table"> <tr id="row1"> <td class="hvr-outline-out">item 1</td> <td>item 2</td> <td>item 3</td> <td>item 4</td> <td>item 5</td> </tr> <tr id="row2"> <td>item 1</td> <td>item 2</td> <td>item 3</td> <td>item 4</td> <td>item 5</td> </tr> <tr id="row3"> <td>item 1</td> <td>item 2</td> <td>item 3</td> <td>item 4</td> <td>item 5</td> </tr> <tr id="row4"> <td>item 1</td> <td>item 2</td> <td>item 3</td> <td>item 4</td> <td>item 5</td> </tr> <tr id="row5"> <td>item 1</td> <td>item 2</td> <td>item 3</td> <td>item 4</td> <td>item 5</td> </tr> </table> <button id="button">test</button> </body> jquery/javascript $('td').click(function() { alert("hello"); });
this jquery code:
$('td').click(function() { alert("hello"); alert($(this).text()); }); it not run, if not include jquery library: demo: https://jsfiddle.net/enmydky4/7/
Comments
Post a Comment