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
-
3Stackoverflow isn't a code writing service. Try it for yourself (otherwise you won't learn anything from the experience), and come back when you have specific issues and some actual code.Anthony Grist– Anthony Grist2012-03-05 09:15:26 +00:00Commented Mar 5, 2012 at 9:15
-
1Yes, show an example of what you've tried already and what didn't work. Don't be lazy.Soviut– Soviut2012-03-05 10:05:04 +00:00Commented Mar 5, 2012 at 10:05
-
Thank u all who responded to my query and i got the solution to my query ..Bhadra– Bhadra2012-03-05 13:15:23 +00:00Commented Mar 5, 2012 at 13:15
Add a comment
|
3 Answers
See this jsFiddle snippet:
It returns the raw text inside all of the tds in the clicked row. Of course, if you need something more specific, continue with jQuery / JavaScript programming to get specific cells etc.
Comments
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