NOTE: QUESTION HAS BEEN EDITED FROM ORIGINAL FOR CLARITY
Hi all,
I have the following code:
<table id="myTable">
<th>Date</th>
<th>Action</th>
</table>
and
var $table = $('#myTable');
There is a condition in my JS where I will be appending table rows (<tr>
) to this table, but I want to write a function to check to see if any have been added or not.
So I'm looking for a boolean expression that returns true if $table contains any <tr>
tags, and false otherwise. Preliminary answers lead me to believe I need to use the jQuery ':has' selector. Thanks very much.