Jquery find text in a td after current td -


i'm using jquery (coffeescript) in rails 3.2 app. in form, want add checks using jquery.

if user changes value of containing class 'numeric', want check input has typed next of class 'text'. i'm debugging right now. can't content of next text field.

this html:

<tr>   <td class="strongnowrap">construction costs</td>   <td class="typical"></td>   <td class="typical_dollars"></td>   <td class="calculated"></td>   <td class="amount"><div class="control-group integer optional costproject_costestimates_amount"><div class="controls"><input class="numeric integer optional" id="costproject_costestimates_attributes_0_amount" name="costproject[costestimates_attributes][0][amount]" style="width:100px" type="text" value="120000"></div></div></td>   <td>   <a rel="popover" data-content="estimated cost contractor construct project" data-original-title="" title=""><i class="icon-search"></i></a>  </td>  <td class="note"><div class="control-group text optional costproject_costestimates_notes"><div class="controls"><textarea class="text optional" cols="40" id="costproject_costestimates_attributes_0_notes" name="costproject[costestimates_attributes][0][notes]" rows="1" style="width:150px">to improve looks</textarea></div></div></td> </tr> 

this code i'm trying:

$('.numeric').change ->   note = $(this).next().find('.text').html()   thought note = 'to improve looks'   **or - tried test see if empty**   $(this).closest('tr').next('.text').is(":empty") 

i 'undefined' errors.

thanks help.

you close:

$(this).closest('tr').find('.text').is(":empty") 

.find children (and children) of tr - next looks @ next element, , didnt have class .text - undefined.


Comments

Popular posts from this blog

html - height not adding height to a empty div -

Oracle SQL. How to select specific IDs where value of columns specify criteria? -

python - Robot Framework location and name of keyword -