jquery add row on click only if it's empty?
- by KittyYoung
The code below works, insomuch that if I click in an input field, it'll add another row. I'm trying to figure out though, how to do that only if the input field is empty?
$("#tableSearchData > tbody > tr > td > input").bind('focus', function(){
var row = $(this).closest("tr").get(0);
if( row.className.indexOf("clicked")==-1 )
{
var rowCopy=$(row).clone(true);
$(row).closest("tbody").append(rowCopy);
row.className+=" clicked";
}
});