Click here to Skip to main content
15,896,402 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a script to run section tag on 'onload' event for timer. It is working with content page but it is not working with the webform can anyone suggest me with this.

This timer has done in separate javascript file

What I have tried:

<script src="../Scripts/jquery-3.3.1.js"></script>
<script src="../Scripts/jquery-3.3.1.min.js"></script>
<script src="../Scripts/countdown.js"></script>
<script type="text/javascript">
    $(function () {
        $('section[onload]').trigger('onload');
    });
</script>

These scripts added in head tag not in closing tag of body.

<section style="width:20%;float:left;height:318px;margin:20px;position:fixed;" onload="startTimer()">
    <div class="timer"></div>
</section>


This startTimer() method is written in countdown.js file. This file is working in master content page but not in webform. How to achieve this
Posted
Comments
F-ES Sitecore 25-Oct-18 5:10am    
It's impossible to say from the info you've given. In the dev tools check the console for javascript errors, and check the network tab for 404 errors when loading the scripts.
Member 8583441 25-Oct-18 6:58am    
Thank you sir for suggesting to check the errors in console. I have checked it and solved but one thing it is decreasing 2 seconds at a time. Please suggest me for this issue
Member 8583441 25-Oct-18 7:02am    
for this also same i have checked with the errors in javascript console and solved now working as usual. As suggested by F-ES Sitecore. Thanks a lot sir
F-ES Sitecore 25-Oct-18 7:19am    
if it's doing 2 seconds at a time you're probably kicking the script off twice. You're binding to the onload event in your js, and you also have an "onload=" in the section itself, so it's probably doing it twice.
Member 8583441 25-Oct-18 13:30pm    
Thanks a lot you are right I called it twice so it's running in that way..... I removed it and seen the output now it's working fine thanks a lot for showing me the error where I am getting it....

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