Friday, 27 September 2013

jQuery- walk through YouTube URLs and add options

jQuery- walk through YouTube URLs and add options

I have a series of YouTube URLs on the page, that each look like one of
these:
<iframe width="640" height="360"
src="//www.youtube.com/embed/XFMjR2SgEP0?list=PLd4hww6QWFS5HMUQzSs3r-90jMRtCiCdi"
frameborder="0" allowfullscreen></iframe>
<iframe width="640" height="360" src="//www.youtube.com/embed/DVPP1elkhKU"
frameborder="0" allowfullscreen></iframe>
As you can see, the first tag above has a 'list' parameter at the end of
the URL; the second tag has no parameters on the URL.
I need to use jQuery to append a new parameter, showinfo=0, to every
YouTube URL on the page. And obviously this needs to be preceded with
either ? or &, depending on if there are other parameters before it.
How?

No comments:

Post a Comment