Why does the click function not work after I change the class of a button?
<p>I have a set of buttons(previous &amp; next) that the user clicks.</p>

<pre><code>&lt;a id="prev_btn" class="prev_1" href="#"&gt;Previous&lt;/a&gt;
&lt;a id="next_btn" class="next_1" href="#"&gt;Next&lt;/a&gt;
</code></pre>

<p>When the user clicks on the next button(.next_1), it changes the class name of the button to next_2 and changes the the previous button(.prev_1) to prev_2. Once the class name is changed, the click function that is set for prev_2 doesn't work.</p>

<pre><code>$('.next_1').click(function() {
  $('#next_btn').removeClass('next_1').addClass('next_2');
  $('#prev_btn').removeClass('prev_1 inactive').addClass('prev_2');
});

$('.prev_2').click(function() {
  alert('this works');
});
</code></pre>

<p>Why does the click function not work after I change the class using jquery?</p>
