0

Could anyone please suggest what I'm doing wrong:

I want the list of YouTube video IDs in my #videoslist DIV to be split into and populate an array used by a simple video carousel I found.

When the array of video IDs is explicitly declared in the script, it works fine, but if I take the .text() or .html() (jQuery) of the DIV and split that into an array, even though the array gets populated fine, there seems to be a problem somewhere that means it doesn't work, but I can't figure it out...

Any help is much appreciated!

2
  • jsfiddle.net/PYMBB Commented Jan 15, 2013 at 15:57
  • maybe you need to trim values of your array before using them into the carrousel ? Commented Jan 15, 2013 at 16:00

1 Answer 1

4

This is because there are spaces after the semicolons. You can either remove the spaces after the semicolons in your DIV or trim the strings before adding them to the YouTube code.

Sign up to request clarification or add additional context in comments.

2 Comments

I made a modification to your Fiddle and it seems to work by removing those spaces: jsfiddle.net/PYMBB/1
Thanks so much! So embarrassing... :) I changed the .split(";") to .split("; ");

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.