I am using jquery mask plugin https://igorescobar.github.io/jQuery-Mask-Plugin/
i want to validate the field ipaddress if the user enter 192.3.4. and forgot to put value after . then i want to validate the text input box then when the user click on the save button
Here is my Html
<input type="text" class="form-control ip_address" placeholder="*IP Address">
and here is my jquery for the plugin mask
$('.ip_address').mask('0ZZ.0ZZ.0ZZ.0ZZ', {
translation: {
'Z': {
pattern: /[0-9]/, optional: true
}
}
});
and here is how i want to validate the user on burron click
$('.btnsaveForm').on('click', function(e) {
e.preventDefault();
var ip = $('.ip_address').val();
if(ip){
alert('ip address');
}else{
alert('not an ip address');
}
});
Kindly help me Thanks