Javascript - How to validate ipaddress using javascript, Validate ip address using javascript
How to validate ipaddress using javascript
Mostly we user to validate ipaddress and email using regula exression from server side, it is also not a very bad idea to validate IP Address using simple javascript. Below is the javascript code to validate IPAddress.function ValidateIPaddress(inputText) { var ipformat = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; if(inputText.value.match(ipformat)) { document.form1.text1.focus(); return true; } else { alert("You have entered an invalid IP address!"); document.form1.text1.focus(); return false; } }Above code can be used to validate IP Address from client side, which will be an addition check to validated from client side.
Simple Example for Valid IPaddress
192.168.0.150 192.168.0.1 10.10.10.0
The topic on Javascript - How to validate ipaddress using javascript is posted by - Guru
Hope you have enjoyed, Javascript - How to validate ipaddress using javascriptThanks for your time