jquery - How to find the input tags contained in a table -


i have question regarding find method.

i want able identify cell contains input tag.

my html like

<table>    <tr>       <td> celll </td>       <td> celll </td>       <td> celll </td>    </tr>    <tr>       <td> celll </td>       <td> <span><input type='text'></span> </td>       <td> <span><input type='text'></span> </td>    </tr> </table> 

my jquery

$('table').find('td').each(function(){           if($(this).find("input").length){              console.log('found')           }       }) 

my codes can't seem find it. tips? lot!

rather using .find() twice, use once , .closest() cell:

$('table').find('input').each(function(){     var parent = $(this).closest('td');     //do parent }); 

demo: http://jsfiddle.net/dirtyd77/kdl97/


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -