Grow your CSS skills. Land your dream job.

Last updated on:

Get YouTube Key from a Link

// Example link:
// <a id="myLink" href="">Youtube link</a>

var youtubeLink = document.getElementById('myLink').href;
var youtubeVideoKey = youtubeLink.substr(youtubeLink.lastIndexOf("v=") + 2, 11);

// youtubeVideoKey will return "cyRqR56aCKc"


  1. Permalink to comment#

    Amazingly timely! I was just trying to work this out myself when this showed up in my RSS feed; thanks!

  2. Permalink to comment#

    I’ve been exploring for a little bit for any high-quality articles or blog posts on this kind of area . Exploring in Yahoo I finally stumbled upon this web site. Reading this information So i’m satisfied to express that I’ve an incredibly excellent uncanny feeling I found out exactly what I needed. I such a lot indisputably will make sure to do not forget this website and give it a glance on a continuing basis.

Leave a Comment

Posting Code

Markdown is supported in the comment area, so you can write inline code in backticks like `this` or multiline blocks of code in in triple backtick fences like this:

<div>Example code</div>

You don't need to escape code in backticks, Markdown does that for you. If anything screws up, contact us and we can fix it up for you.

*May or may not contain any actual "CSS" or "Tricks".