1

How can I get the time entered into an input field and pass it to jQuery to show in a div in seconds? I would like to use the jQuery show() function if possible. Would this keep it triggered if browser is refreshed?

To convert the time I'm using this but I'm getting 0 seconds.

function TimeToSec() {
    $sec = 0;
    foreach (array(explode(':', $input_time)) as $k => $v) 
        $sec += pow(60, $k) * $v;

    return $sec;

and I'm triggering using jQuery:

function live() {
    jQuery(".live").show();
}
Andrew Li
  • 55,805
  • 14
  • 125
  • 143
dexter4000
  • 77
  • 7

1 Answers1

0

To get the seconds of the time entered you can use the same solution detailed in this other question: Convert HH:MM:SS string to seconds only in javascript

Community
  • 1
  • 1
Michael
  • 288
  • 1
  • 7