Hi and thanks for looking into this.
I have a code I’ve been working on to add videos to my site. All videos are from youtube. Once a user has clicked on submit, a link becomes visible. When clicking on it the user can preview the video.
One week ago I used the following to achieve this:
$("#result").html('<a href="javascript:initPlayer(\'http://www.youtube.com/watch?v=kXhy7ZsiR50\')>Preview video</a><br>');
Everything worked fine. But today I was trying the script and the link doesn’t appear anymore. The link works however fine if I do something like:
<a href="javascript:initPlayer('http://www.youtube.com/watch?v=kXhy7ZsiR50')">Preview video</a>
Somewhere on the page.
I don’t know why the call with jQuery doesn’t work anymore. It worked fine when I was developing the website. I tried it on different browsers, but with the same result in the end.
Anyone any idea how to solve this? I’m starting to pull out my hair. 🙂
Thanks in advance.
This seems to work fine:
I think it’s a double/single quotes problem. Everything is back to normal.