I want to make a userscript for a website, where I want to extract and select the date in some <td>
fields.
Example:
<tbody>
<td><img></td>
<td>something</td>
<td>something</td>
...
<td style="text-align:center;">2016-02-10 13:27</td>
<td>something</td>
...
<td>something</td>
</tbody>
There are two things I want to do:
1. compare the date with another stored date (and check if it is later).
2. change the background-color of the <td>
element where the date is located.
This is what I have, and it returns an empty array...
var dateArray = [];
$("td").each(function(){
if(String(this).match(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}/)){
dateArray.push(this);
}
});
What is wrong and/or what could I do in a better way?
Thanks!