title: How to detected forbidden letters in a variable that comes from html in javascript?
body: <p>acutally my english is not good but i want to detect forbidden letters in a variable that comes from html input but its not working.
  My code:</p>
  <pre class="lang-js prettyprint-override"><code>nextBtnFirst.addEventListener(&quot;click&quot;, function(event) {
    event.preventDefault();
    //Validating the required Fields//
    var fname = document.getElementById(&quot;fname_id&quot;).value;
    var lname = document.getElementById(&quot;lname_id&quot;).value;
    var letters = &quot;/^[0-9a-zA-Z]+$/&quot;;
    if(fname ==&quot;&quot; || lname==&quot;&quot;) {
      updateError(&quot;First name and Last name is required!&quot;);
    } else {
      slidePage.style.marginLeft = &quot;-25%&quot;;
      bullet[current - 1].classList.add(&quot;active&quot;);
      progressCheck[current - 1].classList.add(&quot;active&quot;);
      progressText[current - 1].classList.add(&quot;active&quot;);
      current += 1;
    } 
  });
  </code></pre>
  <p>What i have tried but didnt work:</p>
  <pre class="lang-js prettyprint-override"><code>if(fname.includes(&quot;!&quot;)) { 
    updateError(&quot;Dont use forbidden Characters!&quot;); 
  }
  </code></pre>
  <p>Please help. Thanks!</p>