jaynp
jaynp

Reputation: 3325

"Unclicking" all jQuery mobile buttons after onClick

I recently asked a question about jQuery mobile buttons staying pressed after they are clicked.

I received a helpful snippet which removes this property:

('#login').find('.ui-btn-active').removeClass('ui-btn-active ui-focus');

But I'm sick of placing it all around my code.

How can I write a global functions which removes the class ui-btn-active ui-focus from any jQuery mobile button that is clicked?

Upvotes: 0

Views: 315

Answers (1)

Rubens Mariuzzo
Rubens Mariuzzo

Reputation: 29251

This script will help you:

jQuery(function($) {
    $(document).on('click', '.ui-btn', function() {
        $('.ui-btn-active').removeClass('ui-btn-active ui-focus');
    });
});

Upvotes: 1

Related Questions