javascript - divide time 0900 to 09:00 -



javascript - divide time 0900 to 09:00 -

if come in 0900 in text field automatically turn 09:00

form

<form action="form.html"> <p> <label>time:</label> <input type="text" name="time" class="time"/> </p> <span id="error" class="hide">error in field</span> </form>

i know should utilize next @ to the lowest degree value , have turn value value want:

$(document).ready(function(){ $(".time").on("focusout",function(){ var old_value = $(this).val(); // old value new value if(old_value.length < 2 || > 4){ $("#error").show(); } else { if(old_value.length == 2){ // add together 2 leading zero's // add together : in middle } else if (old_value.length == 3){ // add together 1 leading zero's // add together : in middle } else if (old_value.length == 4){ // add together : in middle } } }

thanks in advance effort taken. if isn't clear please inquire me.

use basis solve problem:

$("#your_filed_id").on("focusout", function(){ // whatever checking here });

javascript jquery time divide

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -