I have buttons look like this:
<a class="h-modal-btn branch-modal-btn"> Buy Now </a>
The scenario is that I want to remove class and add attributes to the buttons according to the query string passed by the URL. Omit the above steps, I just do
$('a.branch-modal-btn').removeClass('h-modal-btn');
When I check whether the class is removed by checking the developer tools. Well, the class is removed from the HTML. Great! But immediately I found that the code below is still executed.
$('.h-modal-btn').on('click', function() {
// Do somthing
)}
That's so depressing! Please help me, I'll be appreciated.