Registering jQuery click, first and second click

前端 未结 9 885
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 23:23

Is there a way to run two functions similar to this:

$(\'.myClass\').click(
    function() {
        // First click
    },
    function() {
        // Second         


        
9条回答
  •  臣服心动
    2020-11-29 23:48

    If you literally only want the first and second click:

    $('.myClass').one( 'click', function() {
    
        // First click
    
        $('.myClass').one( 'click', function() {
    
            // Second click
    
        });
    );
    

提交回复
热议问题