hh54188
hh54188

Reputation: 15626

The function in jquery "queue" method could be executed only once?

Here is my jquery code:

       $('input').click(function(){
            $('h1').empty().queue(function(){
                console.log('queue');
            });
       });
    });

Only the first time I click the input,the firebug would show‘queue’

but when I click it the second time,it doesn't show anything,how can I execute the queue menthod in click event in more times?

Upvotes: 2

Views: 1042

Answers (1)

panda-34
panda-34

Reputation: 4209

$('input').click(function()
{
    $('h1').empty().queue(function()
    {
        alert('queue');
        $(this).dequeue();
    });
});

Upvotes: 8

Related Questions