Skip to content

Instantly share code, notes, and snippets.

@jtwalters
Last active March 21, 2016 18:09
Show Gist options
  • Save jtwalters/3a1f6754bf123765f585 to your computer and use it in GitHub Desktop.
Save jtwalters/3a1f6754bf123765f585 to your computer and use it in GitHub Desktop.
Parse DOM element's h:mm:ss to seconds and replace (in place).
// Parse duration value from table cell, replacing as seconds...
$table.find('td:nth-child(7)').each(function () {
var value = this.innerHTML.trim(),
seconds = moment.duration(value).asSeconds();
this.innerHTML = seconds;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment