How do I check if a table contains a row with a specific id using jQuery?
Approach 2: Use $('table tr:last') jQuery Selector to find the last element of the table. The 'table' in query looks for the table element then 'tr' is looking for all the rows in the table element and ':last' is looking for the last table row of the table.
jQuery: Code to Fetch HTML table data values and save in JSON object. Here we create an array variable arrData where we store our HTML table data. Here we use the jQuery . each() method to get all table row data.
find("tr"). last();
Just
if($('#rowID').length){
}
should be sufficient..
ID's on a page are unique.. So this check should do..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With