Identify the cell containing a particular class using javascript / jQuery -
i have
var output = '<tr>'+ '<td class="class1">one</td>'+ '<td class="selected">two</td>'+ '<td></td>'+ '<td></td>' '</tr>';
how can identify cell (1,2,3 or 4) has class="selected"
console.log($(output).find('.selected').index());
and remember .index() zero-based.
Comments
Post a Comment