I watched a tutorial from a developpp guy from youtube. I want people not to write bad words in my text area from my form.
But I want them not to write a few words, and not just one, this tutorial does not explain this, and I'm trying to find a way without success, can someone explain to me?
this is actual javascript
HTML
<textarea class="ta" id="ta" name="ta" onkeyup="clean('ta')" onkeydown="clean('ta')" placeholder="A good word for a good word"></textarea>
JAVASCRIPT
<script type="text/javascript">
function clean(el){
var textfield = document.getElementById(el);
var regex = /fuck/gi;
if(textfield.value.search(regex) > -1) {
textfield.value = textfield.value.replace(regex, "");
}
}
</script>
Thanks for your time guys!
source
share