Jquery returns empty value -


this question exact duplicate of:

i using tables input fields in them. trying value set of input fields same class , compare each of adjacent input diffrent class name. can see value in input value returned empty jquery.

$('.subtotal').each(function(){         var price = $(this).parent().parent().find('td input.price');         console.log(price.val());  }); 

here html. these rows repeated.

            <tr>                     <td>                         <input type="text" name="data[<?=$i?>][title]" class="title"/>                         <ul class="order_search_title">                          </ul>                     </td>                     <td>                         <input type="text" name="data[<?=$i?>][author]" class="author"/>                     </td>                     <td>                         <input type="text" name="data[<?=$i?>][isbn]" class="isbn"/>                         <ul></ul>                     </td>                     <td>                         <select hidden="hidden" name="data[<?=$i?>][qty]" id="" class="qty">                              <option value="1">1</option>                             <option value="2">2</option>                             <option value="3">3</option>                             <option value="4">4</option>                             <option value="5">5</option>                         </select>                      </td>                     <td>                         <input type="number"  name="data[<?=$i?>][price]" class="price" readonly />                      </td>                     <td>                         <input type="number" name="data[<?=$i?>][subtotal]" class="subtotal" readonly/>                      </td>                     <td>                         <a href="#" class="cleartext">clear</a>                      </td>                     <td>                         <img class="delete" src="<?=base_url()?>/imgs/delete25.png" />                     </td>                 </tr> 

so there few issues need <table></table> tag around html in order find command find td tag.

also have no value in price have read only, if preset value can see works. here working example of code proper fixes. http://jsfiddle.net/9pulf/


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -