Please help me with my problem.
How can I make my input box only accept IP Addresses whilst now allowing any text?
When I set the input type to NUMBER
it disables the submit button, for example, the input box only accepts input for IP addresses like 192.168.206.103
and it doesn't accept alphabet.
Here is my code:
Script:
function displayCam()
{
var ip = document.getElementById('ipadd');
var portz = document.getElementById('portz');
//document.getElementById('camView').innerHTML = ip.value;
var link = document.getElementById('camView').href="http://"+ip.value+":"+portz.value;
window.location.href =link;
}
CODE:
<h1>Input IP Address</h1>
<label for="ipadd">Enter IP Address:</label>
<input type='text' id='ipadd' required="required" placeholder="XXX.XXX.XXX.XXX">
<label for="portz">Enter Port:</label>
<input type='number' id='portz' pattern=".{1.4}" >
<input type='button' onclick='displayCam()' value='Submit' required="required">
<div id="camView"> </div>