I need to get the selected row values in a table using jquery by clicking on the row or a link.. i am new to jquery ,,anybody help me with sample code..that would help me greately. Thanks in advance
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
See this jsFiddle snippet:
http://jsfiddle.net/hU89p/
It returns the raw text inside all of the td
s in the clicked row. Of course, if you need something more specific, continue with jQuery / JavaScript programming to get specific cells etc.
回答2:
$(document).ready(function () {
$('#YourTableid tr').click(function (event) {
//do your logic here
});
});
回答3:
You mean it:
javascript:
$('table tr td a').click(function(){
alert($(this).text());
});
html:
<table>
<tr>
<td><a href="#">1</a></td>
</tr>
<tr>
<td><a href="#">2</a></td>
</tr>
<tr>
<td><a href="#">3</a></td>
</tr>
</table>
example