marwa m marwa m - 1 month ago 7
Javascript Question

making value of start_time in timepicki variable

I try to make start time in timepicki as shown below , it's not working it gives me another value not as $(".add-time").val().

<input type="text" name="time" value="{{admission.time}}" class="timepicker add-time form-control required">

$('.add-time').timepicki({start_time: $(".add-time").val()});

Answer Source

I split() the val() of the input.The array result plus one element ("AM") its the value of the start_time option.Try the following JQuery code:

var time=$(".add-time").val();
$('.add-time').timepicki({start_time: time});