Append a link to all timecodes (Like YouTube)

i want to find all timecodes in my content area and build a simple link around it, so i can jump to a specific timecode on my WordPress Mediaelement.

How can I do this so it finally looks like:

<div class="timecodes">
  <li>
    **<a class="go-to-time">**15:30**</a>** "Title"
  </li>
</div>

Related posts

1 comment

  1. I figured it out by myself, here is my solution:

    var str=document.getElementById("timecodes").innerHTML; 
    var n=str.replace(/[0-9][0-9][:][0-9][0-9]/gi,function myFunction(x){return "<a class='go-to-time'>" + x + "</a>";});
    document.getElementById("timecodes").innerHTML=n;
    

Comments are closed.