pr- pr- - 4 months ago 25
CSS Question

Input box for changing IP Address

I am trying to create an input field for an IP address, broadcast, and subnet. The inputs are used to change the ip of the server. Its an internal website.

I want to make it so that the user gets an input box that has the periods hardcoded into the text box. This way when they start typing, they only have to input the numbers and be able to tab to the next part of the ip. Or if the user enters 3 characters, it automatically sends him to the next part of the ip.

I don't know if this is something that can only be done with html and css or if this is more of a javascript application.

http://jsfiddle.net/3F2gM/1/

Thanks.

Answer

You can use a mask plugin - DEMO

jQuery(function($){
   $("input").mask("9?99.9?99.9?99.9?99", {placeholder:" "});
});