I have this td:
<td>Jul 18 2019 12:00AM</td>
and I need to convert it to ISO 8601 format using JavaScript. Vanilla or using jQuery would be fine, it's just that I keep getting an 'undefined' when I attempt to parse it, but I think it is having trouble because of the html tags. Any help would be appreciated, thank you.
$(function () {
$("#_ctl0_phMainContent_dgrdClasses3 tbody tr td:nth-child(7)").each(function (index, dateElem) {
var $dateElem = $(dateElem);
var formatted = moment($dateElem.text(), 'MMM DD YYYY h:mm:a').format('MMM DD YYYY h:mm:a').toISOString();
$dateElem.text(formatted); })
})