I\'m trying to validate a form using JavaScript but i\'m a bit stuck on displaying a message next to the field to say that \"This field is required\". How do I go about doing th
Add a span near each field so you can use it for the validation message:
First Name
After that, just add the error message there, so instead of:
alert('You need to complete this field')
You would use:
document.getElementById('firstname_error').innerHTML = 'You need to complete this field'