Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I'd like a video to start playing on page load. I tried to write a script that on page load will click the 'play' button link, but it is not working. That script is

JavaScript
<script>
    $(document).on('ready', function () {
        $(getElementByClass('.mSIcon.mSVideo')).trigger('click');
    )};
</script>

The play button is in the link

Why is this not working? The site is http://smmcnyc.com/work/smmc/smmc1306/[^]

I also need the videos to cycle, and after the first video ends, for the second video to start. Any idea how to solve this as well?
Posted
Updated 18-Mar-15 18:22pm
v2
Comments
Sergey Alexandrovich Kryukov 18-Mar-15 11:37am    
Because you are doing nothing useful in this code. How is it supposed to "work"?
—SA

1 solution

The browser will never allow a script to target an element that is loaded from a different source than itself.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900