I want that in the input field only url should allow so I tried to put type="url" in input tag but it is not working i can find out what preventing it to work. More over if anyone help me to tell is their any way so that I can only allow .com suffix url in the input.
Please help me
window.addEventListener('load', () => {
document.querySelector('button.test-btn').addEventListener('click', e => {
document.querySelector('#test').innerHTML = '<h3>Please Wait...</h3>';
setTimeout(yes, 7000)
})
})
function yes() {
var button = document.getElementById('test');
var name = document.getElementById('name');
var age = document.getElementById('age');
var location = document.getElementById('location');
var str = 'Hello! <p> My name is Ashish</p><p>How Are You: ' + name.value +
'';
document.getElementById('test').innerHTML = str;
};
<label>
Your Name:
<input type="url" id="name" />
</label>
<br />
<button class='test-btn'>Test</button>
<p id="test"></p>