Joofe Kopp Joofe Kopp - 7 months ago 42
Javascript Question

jQuery Datatable - How to delete a row using cell value

I want to search a cell in my JQuery datatable which has the content of var x and delete the row which contains the cell.

I tried this:

function deletedatarow(){
var x = "tzr";
$( "tr:contains('" + x + "')").fnDeleteRow();

but it doesnt work.

Can anyone tell me why and help me to find a solution?


If you're referring to the jQuery DataTables plugin, then you're doing it wrong, your code should look something like this:

// Set oDatatables variable somewhere above this line..    
function deletedatarow(){
  var x = "tzr";
  $( "tr:contains('" + x + "')").each(function() {