I have a credit card field that populates a <span> tag e.g
<span>****-****-****-1111 (Expires 12/2012)</span>
I need to extract the date and find out if it is in the past.
At the moment I have the below jQuery but I’m stuck at the point of split() to extract just the date.
var $selectedDate = $('.prev-card .chzn-container .chzn-single span').text().split();
var $now = new Date();
if ($selectedDate < $now) {
alert('past')
}
else{
alert('future')
}
I think that covers everything but feel free to ask for more info
Try this: