dimanche 10 juin 2018

jQuery if statement, Data correct but dosen't pass thorough

I am having an issue with an if statement which is giving me the right data but no passing through... SO:

i have

-- Hidden Carrier --

<div id="HiddenCurrentDate">
<?php
$CurrentDate = date('d-m-y');
echo $CurrentDate;
?>
</div>

-- row --

<td class="WDClass"><div id="WDD'.$row["id"].'" class="WDDiv">'. 
$row["StartDate"] .'</div></td>

-- jQuery --

var CurrentDate = $("#HiddenCurrentDate").text();
var StartedDates = $(".WDDiv");

$(StartedDates).each(function() {

var DateID = '#' + $(this).attr('id');    
var DateString1 = $(DateID).text();
if(CurrentDate === DateString1){
    alert('Match');
}else{
    alert('No Match: current-' + CurrentDate + " -  Row " + DateString1 );
}

});            

So this here when effected gives me the correct date when called... But it does not pass through the if it just gets "ELSED" :/

Aucun commentaire:

Enregistrer un commentaire