Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if a table has a row with a specific id jquery

How do I check if a table contains a row with a specific id using jQuery?

like image 853
Carl Weis Avatar asked Dec 11 '12 22:12

Carl Weis


People also ask

How to find table row in 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.

How to get all table row data in jQuery?

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.

How to get table last row in jQuery?

find("tr"). last();


1 Answers

Just

if($('#rowID').length){

  }

should be sufficient..

ID's on a page are unique.. So this check should do..

like image 132
Sushanth -- Avatar answered Nov 14 '22 05:11

Sushanth --