Skip to main content

Search and Top Navigation

#6855 closed bug (duplicate)

Opened January 13, 2011 07:08PM UTC

Closed January 24, 2011 02:57PM UTC

Last modified January 23, 2013 02:29PM UTC

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.

Attachments (0)
Change History (3)

Changed January 24, 2011 02:57PM UTC by scottgonzalez comment:1

resolution: → duplicate
status: newclosed

Changed January 24, 2011 02:57PM UTC by scottgonzalez comment:2

Duplicate of #5945.

Changed January 23, 2013 02:29PM UTC by demmith comment:3

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