there has a div and tow click events
HTML:
<div class="noSel"></div>
JS:
$('.noSel').on('click', function(){
    alert('noSel');
    $(this).removeClass('noSel').addClass('sel');
});
$('.sel').on('click', function(){
    alert('sel');
    $(this).removeClass('sel').addClass('noSel');
});
first time click should alert "noSel"
second time click should alert "sel"
but always alert "noSel"
HTML:
<div id="div" class="noSel"></div>
JS:
$('#div').on('click', function(){
    if($(this).hasClass('sel')){
        alert('sel');
        $(this).removeClass('sel').addClass('noSel');
    }else{
        alert('noSel');
        $(this).removeClass('noSel').addClass('sel');
    }
});
This way is OK, but have other way to do this?
 
     
     
    