Using jquery to auto populate only a time input & not other buttons

589 views Asked by At

I am trying to use jquery to auto populate an input time field. It works fine; but it applies the time to my other button. How do I only refer it to my input type time field?

Any help is most appreciated. Thanks

HTML

<input type="time" value="" />
<input type="button" value=""/>

jquery

$("input").val( "17:39:57" );
1

There are 1 answers

0
Balachandran On BEST ANSWER

use attribute equal selector

$("input[type=time]").val( "17:39:57" );

fiddle