2

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

3
  • 3
    Stackoverflow 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. Commented Mar 5, 2012 at 9:15
  • 1
    Yes, show an example of what you've tried already and what didn't work. Don't be lazy. Commented Mar 5, 2012 at 10:05
  • Thank u all who responded to my query and i got the solution to my query .. Commented Mar 5, 2012 at 13:15

3 Answers 3

2

See this jsFiddle snippet:

http://jsfiddle.net/hU89p/

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.

Sign up to request clarification or add additional context in comments.

Comments

2
$(document).ready(function () {      
 $('#YourTableid tr').click(function (event) {
       //do your logic here
 });
});

Comments

0

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​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.