BruceyBandit
BruceyBandit

Reputation: 4334

Cannot assign jQuery Timepickers in 2 differents Text Input.

I have two Timepickers. Problem is though that both timepickers belong to one text input (start time input) when they should belong to 2 different ones.

durationpicker is for the duration input and timepicker is for the start time one.

How can I seperate the timepickers so they belong to the right input ?

below is jQuery code:

$('#durationpicker').timepicker({});

$(function() {
    $('#timepicker').timepicker({
        showOn: 'button',
        button: '.timepicker_button_trigger'
    });
});

And the HTML :

 <form action="QandATable.php" method="post" id="sessionForm">
   <p>
     <strong>3: Duration:</strong>
     <input type="text" id="durationpicker" name="durationChosen" readonly="readonly"/>
   <p>
    <strong>5: Start Time:</strong>
    <input type="text" id="timepicker" name="timeChosen" readonly="readonly" />
    <span class="timepicker_button_trigger">
      <img src="Images/clock.gif" alt="Decrease" />
    </span> <br/>
    <span id="dateTimeAlert"></span>
  </p>
</form>

Note : I am using Trentrichardson's Timepicker for duration input and François Gélinas for start time input.

Upvotes: 1

Views: 141

Answers (1)

Albireo
Albireo

Reputation: 11095

You have declared #durationpicker's timepicker outside of the "document ready" function, it won't work.

Try moving it near the other one.

Upvotes: 1

Related Questions