title: Javascript form validation on next button i have same class for all button?
body: <p>I'm new in JavaScript, and need some help with form validation.</p>
  
  <p>I've got a form with 3 buttons, named as next, previous and at the end submit these button have same class name btn, when I put the function on next button with class btn it applied on all, and I fail to change class or add any ID because this is in JavaScript.</p>
  
  <p>Can any one can tell how to handle by btn class but only apply on next button?</p>
  
  <p>my code is </p>
  
  <pre><code>&lt;form class="ms-form"&gt;
      &lt;input type="text"&gt;
      &lt;button class="btn"&gt;prev&lt;/button&gt;
      &lt;button class="btn"&gt;next&lt;/button&gt;
      &lt;button class="btn"&gt;submit&lt;/button&gt;
  &lt;/form&gt;
  &lt;script&gt;
      $(.btn).click(function() {
          alert('ok');
      });
  &lt;/script&gt;
  </code></pre>