Emm Emm - 15 days ago 5
jQuery Question

Two elements in jQuery find() and If conditional

I want to apply a statement if specific values of two cells in my table exist, but I don't know how to do that statement.Than

$(function() {
$("#pizarra #trPizarra").each(function() {
var filon = $(this).find('#tdEdo, #tdImg').text();

if (filon == "listo") {
alert('LISTO');
}

});
});

Answer

Here's a quick solution. The || operator will do it for you. Hope it helps!

$(function() {
 $("#pizarra #trPizarra").each(function() {
    if ($(this).find('#tdEdo').text() === 'listo' || $(this).find('#tdImg').text() === 'listo'){
        alert("listo");
    }
 });
});