<html>
<body>
<form action="https://www.w3schools.com/action_page.php">
Facebook profile: <input type="url" id="myURL" name="fb">
<input type="submit">
</form>
<p>Click the "Try it" button to specify a regular expression that the URL field's value will be checked against. Note that we also set the "title" to describe the pattern.</p>
<button onclick="myFunction()">Try it</button>
<p><strong>Note:</strong> elements with type="url" are not supported in IE 9 (and earlier), or Safari.</p>
<p id="demo"></p>
<script>
function myFunction() {
document.getElementById("myURL").pattern =
"http://www/\.facebook\.com\/(.+)|https://www\.facebook\.com\/(.+)";
document.getElementById("myURL").title =
"URL%20must%20start%20with%20http_/www.facebook.com/index.html";
document.getElementById("demo").innerHTML =
"The URL field now only accept URL's that start with http://www.facebook.com/ or https://www.facebook.com/.";
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_url_pattern2 by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:17:21 GMT -->
</html>