Variable in Select not update

Variable in Select not update

Hi,

im whit this code

  1. var num=1;
  2. var num2;
  3. $(document).ready(function(){
  4. $('.cntrlr-'+num+'-ok').on('click', function() {
  5. num2=num+1;
  6. $('.scnr-'+num).addClass('hidden');
  7. $('.scnr-'+num2).removeClass('hidden');
  8. num=num+1;
  9. });

The problem is into  $('.cntrlr-'+num+'-ok'), only go when the class of object clicled is 1 (. cntrlr-'1'-ok'). The num variable change correctly but the  $('.cntrlr-'+num+'-ok') not update.

Thanks,