I'm trying to prevent users from inputting and submitting single quotes ( ' ) into the textarea. below is what I have, but it isn't work.
<script>
function valtxtarea() {
var val = document.getElementById('textarea').value;
if ('\''.test(val)) {
alert('do not add single qoutes to your inputs!');
}
}
</script>
<form>
enter text below
<textarea>input contents here</textarea>
<input type="button" onclick="valtxtarea();" value="send">
</form>
/'/.test(val). You should have been getting a.test is not a functionor similar error on your browser's developer tools console