Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#6855 closed bug (duplicate)

UI button fires click event even if disabled

Reported by: volvox Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.button Version: 1.8.7
Keywords: Cc:
Blocked by: Blocking:

Description

When creating button from a span element it fires click event even if the button has been disabled after. On a button html element it behaves as expected.

It's seems this behavior is caused by ':disabled' selector used inside ui.button code which doesn't work on elements except of input and button elements.

Not sure if it is a bug - but it should be documented at least.

$(function() {
    $('body')
        .prepend($('<button class="button">button</button>'))
        .prepend($('<span class="button">span</span>'));
    
    $('.button')
        .button()
        .button('disable')
        .click(function() {
            alert('The "' + $(this).text() + '" was clicked.');
        })
})

After running this code the 2nd button is still clickable.

Change History (3)

comment:1 Changed 9 years ago by Scott González

Resolution: duplicate
Status: newclosed

comment:2 Changed 9 years ago by Scott González

Duplicate of #5945.

comment:3 Changed 7 years ago by demmith

That's a "large block of code"?!

Note: See TracTickets for help on using tickets.