Click here to Skip to main content
15,921,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
here i am trying to fetch values of a particular column for a selected row via jquery.In Following code i have two rows which do not have any id.I tried following way and getting both rows value for that column appending each to get value for that row only using jquery only.

<script src="">
<script type="text/javascript">

function test(){
var id = $(".use-address").closest("tr").find('td:eq(2)').text();

<table id="choose-address-table" class="ui-widget ui-widget-content">
    <tr class="ui-widget-header ">
      <td class="nr"><span>50</span>

      <td>Some Street 1</td>
      <td>G0 0XX</td>
      <td>United Kingdom</td>
        <button type="button" class="use-address" onclick="test();">Use</button>
      <td class="nr"><span>30</span>
      <td>Some Street 2</td>
      <td>G0 0XX</td>
      <td>United Kingdom</td>
          <button type="button" class="use-address" onclick="test();">Use</button>
Updated 10-Feb-20 18:21pm
Sergey Alexandrovich Kryukov 26-Mar-14 11:28am    
First of all, it means "single cell". Very good, but what does it mean, "selected"? What is the selection mechanism?
Getting a value with jQuery is not going to be a problem at all; just reads the documentation.
Member 10624370 26-Mar-14 11:35am    
here meaning of selection is on click of that element of row.

1 solution

Remove onclick function try this

 $("body").on('click', '.use-address', function() {
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900