I have been browsing this site for along time to help me learn various parts of coding and found it most helpful. I am struggling much so with Jquery & PHP to a point I cannot find my answer.
I am probably asking it wrong. But I need to be able to use JQuery countdown timer function to use one of my PHP variables, when a button is clicked, if this is possible?
<b><span style="color:red"><div id="Count"></div></span></b>
<script type="text/javascript">
$('#Count').countdown({until: '+0h +0m +15s', significant: 2,
expiryText: '<div class="over"><h3>Finished</h3></div>',
layout: '{d<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl}{s>}'});
<button>Start</button>
</script>
This is my current JQ option, but automatically activates when I load the page. I require it to start when I click the button.
Also from the top you will see it uses 15 seconds. I have tried to replace it with my PHP variable which is
$count1
But this did not work :(
Any advice would be most helpful as JQ is a new language to me and I am struggling to start. Thanks for your time.
$('#Count').countdown({until: '+0h +0m +<?php $count1; ?>s', ...(2) your button is currently inside your</script>tag<button>Start</button> </script>, is that just a copy/paste issue here? (3) If you want your jquery code to only start after a button click, then wrap it -$('button').click(function(){ $('#Count').countdown({ ...[rest of code]... }); });