I want to restrict what characters a user can type in an input text field such that they can only type in numbers and periods and colons. So if they type anything else, it won't show up or register. This is for IP addresses for example: 10.200.66.106:8888
How can I achieve this in jQuery?
I've written a little example in jsFiddle: http://jsfiddle.net/6xMxs/
HTML:
<div id="outer">
<div id="inner">
<p>IP Address:</p>
<p class="edit">2323</p>
</div>
<div>
jQuery:
$(document).ready(function() {
$('.edit').editable('ipaddress/update',{
type : 'textarea',
cancel : 'Cancel',
submit : 'OK',
tooltip : 'Click to edit...'
});
});