1. This website uses cookies to improve service and provide a tailored user experience. By using this site, you agree to this use. See our Cookie Policy.
    Dismiss Notice

Need some Javascript help on my Wordpress website PLS

Discussion in 'Programming' started by michaeladewale2010, Nov 7, 2017.

  1. michaeladewale2010

    michaeladewale2010 Regular Member

    Joined:
    Jan 14, 2015
    Messages:
    222
    Likes Received:
    68
    on this page hxxp: // brandi - design . com/ 1branding- business- success-test-live/

    i have the subscribe button setup as disabled until the video is finished playing. i did that with javascript using the following code:

    <a title="ELIGIBLE AFTER VIDEO IS COMPLETED" id="myBtn" class="yellow34">BOOK NOW AND GET 30% OFF</a>
    <script>
    var myBtn = document.getElementById("myBtn");
    myBtn.disabled = true;
    </script>

    <script type='text/javascript'>
    document.getElementById('myVideo').addEventListener('ended',myHandler,false);
    function myHandler(e) {
    document.getElementById("myBtn").disabled = false;
    document.getElementById("myBtn").title = 'ACCESS YOUR FREE GIFT';
    document.getElementById("myBtn").style.background='#faa000';
    document.getElementById("myBtn").href = "#boxzilla-46264";
    }
    </script>


    thing is i have the button on 2 parts of the page. the first is right after the video and 2nd is on the bottom of the page.

    the issue i am having is that after the video is completed, the button right under the video becomes active but the one on the bottom of the page doesnt. it is the same exact code i used for both but i wonder why this bottom one doesnt work as is intended.

    any help will be greatly appreciated as i have tried numerous things to no avail. thanks
     
  2. michaeladewale2010

    michaeladewale2010 Regular Member

    Joined:
    Jan 14, 2015
    Messages:
    222
    Likes Received:
    68
    never mind. sorted.

    i defined the 'myBtn' id twice (on both buttons) and id's should be unique. changed the id on the 2nd button and it all works fine now.