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 });
Comments
Post a Comment