I want to use: HTML 5 Required.
such as
<input type='text' required>
it only seems to work if the input type is in a form.
Can I not use it on its own and then by javascript call some sort of validate first method ?
More comments following feedback:
I have
<input id='name' type='text' required>
<input id='surname' type='text' required>
<input id='send' type='button' onclick ='send()'>
function send() {
if (document.getElementById('name').value == '') { alert('missing name'); return }
if (document.getElementById('surname').value == '') { alert('missing surname'); return }
// logic now...
}
The bit where it checks the input params and sends alert that’s the bit I would like to change by using HTML 5
Sure, use
to check validity of field dynamically.