-1

i need to change value for all td's how can i all td under tr

i have DISReferralId 27 ... by this id how to filter

code :

<tr class="alter-bgcolor">
     <td class="grid_normal_column">42423</td>
        <td class="grid_normal_column">Etet Eryrytry</td>
        <td class="grid_normal_column">17/03/2014</td>
        <td class="grid_normal_column">No</td>
        <td class="grid_normal_column">No</td>
        <td class="grid_normal_column"></td>
        <td><input type="hidden" name="DISReferralId" id="27" value="27"></td>
        <td class="grid_normal_column">New</td>
  </tr>
Bharathi Devarasu
  • 7,759
  • 2
  • 18
  • 23

1 Answers1

1

To get the input element:

  • using nameattribute:

    var elem = $('input[name="DISReferralId"]');
    
  • using valueattribute:

    var elem = $('input[value="27"]');
    
  • using both name and value attributes:

    var elem = $('input[name="DISReferralId"][value="27"]');
    
  • using id attribute:

    var elem = $('#27');
    // or
    var elem = $('input[id="27"]');
    

Then to get all tds of the row containing that input:

                 parent    parent
                   td       tr        all tds
                    |        |           |
                    \/       \/          \/
var alltds = elem.parent().parent().children()

// or

                 parent   all tds excepts
                   td     input parent td  add input parent td
                    |       |               |
                    \/      \/              \/
var alltds = elem.parent().siblings().addBack()
manji
  • 47,442
  • 5
  • 96
  • 103