Show Alert if Any Bad/Filtered Word is present in form input
<p>I am trying to get rid of the SPAM contact mails I am receiving through my website.  </p>

<p>I have a list of banned words, one per line format. Now I want to implement something that can show an alert if any of the banned words is present in the form inputs and prevents the form submit. How can I do that?  </p>

<p>Here is the code I tried, but that failed. I don't know how to match that one per line words or phrases with the input data.</p>

<p>HTML  </p>

<pre><code>&lt;form method="post" action="/sendmessage.php"&gt;
&lt;input type="text" id="name" name="name" /&gt;
&lt;input type="text" id="email" name="email" /&gt;
&lt;input type="text" id="subject" name="subject" /&gt;
&lt;input type="textarea" id="message" name="message" /&gt;
&lt;input type="submit" id="submit" name="submit" value="Send Message" /&gt;
&lt;/form&gt;
</code></pre>

<p>JavaScript  </p>

<pre><code>&lt;script type="text/javascript"&gt;
$(function() {
    $("#submit").on("click",function() {
        var name = $("input:text[name='name']").val();
        var email = $("input:text[name='email']").val();
        var subject = $("input:text[name='subject']").val();
        var message = $("input#message").val();
            var badwords = (abc // first bad word, followed by a carriage return
                            bcd // second bad word, followed by a carriage return
                            cdf // third bad word, followed by a carriage return
                            ...
                            the bad phrase // bad phrase, followed by a carriage return
                            another bad phrase // another bad phrase, followed by a carriage return
                            ...
                            xyz
                            );

        /* I am not sure what to do from now on */ 

                if (name || email || subject || message ) {
                    alert("Your Message Contains Bad Words, Please Remove Them Before Proceeding");
                    return false;
                }
        /* I am not sure what to do */ 
    });
});
&lt;/script&gt;
</code></pre>

<p>Please Help</p>
