I want to do some error checking in the script for the input of a textarea, i.e. if there is no input, showing an alert. I've tried to use value="" value='' , but seems all cannot work.
Field
<div class="field">
<label>remarks:</label>
<textarea id="id_remarks" name="remarks"></textarea>
</div>
Save button
<input type="submit" value="Save" onclick="verify()"/>
Function
<script>
function verify(){
if (document.forms[0].elements['id_remarks'].value=='') {
alert('Please enter the remarks')
}
</script>
Can anyone help on how to do it? thanks very much