Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As mentioned, you can use Javascript for this entirely.</p> <p>If you do wish to use PHP + Javascript, you need to expand your timer callback to parse the time. Check this question for an example:</p> <p><a href="https://stackoverflow.com/questions/4680028/javascript-how-to-parse-a-date-string">javascript: how to parse a date string</a></p> <p>Once you parse the various parts of the time, you can then use hide() if the timer reaches zero.</p> <p>With jQuery, you can parse the time parts like this:</p> <pre><code>var days = $("#timer .value").eq(0).html(); var hours = $("#timer .value").eq(1).html(); var mins = $("#timer .value").eq(2).html(); var secs = $("#timer .value").eq(3).html(); </code></pre> <p>However, you will need to put the value itself in a separate div, i.e. something like:</p> <pre><code>echo "&lt;div class='value'&gt;$days&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;p class='time'&gt;Days&lt;/p&gt;&lt;/div&gt;"; echo "&lt;div class='value'&gt;$hours&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;p class='time'&gt;Hours&lt;/p&gt;&lt;/div&gt;"; echo "&lt;div class='value'&gt;$mins&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;p class='time'&gt;Mins&lt;/p&gt;&lt;/div&gt;"; echo "&lt;div class='value'&gt;$secs&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;p class='time'&gt;Secs&lt;/p&gt;&lt;/div&gt;"; </code></pre> <p>This way, you can get the whole contents of the value div without breaking up the value it contains into chunks. If you absolutely must have everything in the same div, you can split the div contents with Javascript's split() function:</p> <p><a href="http://www.w3schools.com/jsref/jsref_split.asp" rel="nofollow noreferrer">http://www.w3schools.com/jsref/jsref_split.asp</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload