title: how to display error message next to textbox in javascript?
body: <p>I am new to Javascript. So I had a doubt  for the following function, how to display the error message next to text box? right now it is showing a alert message, but I need to change the alert message and need to  display it  next to textbox?</p>
  
  <pre><code>function AllowLock(){
      if (!locker.lock.value.match(/[a-zA-Z]$/) &amp;&amp; locker.lock.value !="") {
          locker.lock.value="";
          alert("Please Enter only valid lock");
      }
      if(locker.lock.value.length &gt; 5)
          alert("max length exceeded");
      } 
  }
  </code></pre>