Reputation:
Do you have any idea why the console.log below is showing the value I have stored in the array videoList (itself an array of file locations)
$(window).load(function(){
videoChoice = videoList[7];
console.log(videoChoice); // output: value I have stored in the array (another array)
setUpVideo($("#video-player", videoChoice));
})
while the console.log inside the called function is showing undefined:
function setUpVideo(element, vid){
console.log (typeof(vid)); // output: undefined
}
Any help is greatly appreciated. If you need more code just ask. I thought it'd be best to keep my question short and uncluttered but it seems I'm not great at asking questions from my experience here.
Thank you, Niall
edit: I had a look at similar questions here but didn't see any clear answers (probably more to do with my ability to understand them I admit)
Upvotes: 0
Views: 124
Reputation: 5615
Error in line
setUpVideo($("#video-player", videoChoice));
inside $()
symbol jquery treats it as selector.
use
$("#video-player"), videoChoice);
should give you expected results
Upvotes: -1
Reputation: 134
Try to do:
setUpVideo($("#video-player"), videoChoice);
instead of:
setUpVideo($("#video-player", videoChoice));
Upvotes: 4
Reputation: 165
Parenthesis... instead of
setUpVideo($("#video-player", videoChoice));
do
setUpVideo($("#video-player"), videoChoice);
Upvotes: 7