I am trying to create an application that takes input from a user using a text field. Split the string into the spaces and look for bad words in the string. If the bad word is found output results on the DOM.
I have been looking on for a form and could not find one. I found some PHP ones but that does not help me. I believe I have the correct pseudocode. Some guidance would be helpful.
HTML is below:
<body>
<input type="text" id="wordInput"/>
<button id="badWordCatch" onclick="badWordCatch;">Catch Bad Words</button>
<div id="wordsFound"></div>
<div id="wordAmount"></div>
</body>
Javascript is below:
1. What words are put it
2. if the words are bad or not
*/
function badWordCatch(){
var wordInput = document.getElementById("wordInput").value;
// split the words by spaces (" ")
var arr = wordInput.split(" ");
// bad words to look for
var badWords = ["legos", "cloud", "manifold"];
//find bad words from the input
//output on the dom "if bad words were found"
//output on the dom how many bad words were found
}