I have a div block like this:
<div id="myDiv">
<table>
<tbody>
<tr>Some data</tr>
</tbody>
</table>
</div>
All I want to do is check if the <tr></tr> has some text in it and display this div block in a dialog box, otherwise don’t do anything.
What would be the best way to do this? I don’t know how to check if the <tr></tr> is empty or not.
First of all you have invalid html. The
trtag can contains one or more th or td elements (W3C). So fix your html.As for validation using jQuery:
http://jsfiddle.net/JnyJs/1/