Search and Top Navigation
#5951 closed bug (duplicate)
Opened August 15, 2010 06:43AM UTC
Closed May 17, 2011 03:24PM UTC
Last modified October 11, 2012 09:15PM UTC
Button from A tag can't be disabled
Reported by: | vs-pvt | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | ui.button | Version: | 1.8.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
<a id="button" href="#">Disabled button</a> <script type="text/javascript"> jQuery('#button').button({ disabled: true }); </script>
UI generates button but it's can't be disabled.
Invoking method .button('disable') do nothing too (((
Attachments (0)
Change History (11)
Changed August 19, 2010 04:50AM UTC by comment:1
Changed September 06, 2010 01:41AM UTC by comment:2
I need initialy disabled button with disabled state by using native UI methods.
This workaround only prevents click action.
Changed September 06, 2010 06:39AM UTC by comment:3
- The "A" element seems to have no "native" UI method to prevent click action.
- The "BUTTON" element seems to have the "disabled" attribute to prevent click action.
- http://www.w3.org/TR/html401/struct/links.html#h-12.2
- http://www.w3.org/TR/html401/interact/forms.html#h-17.5
- http://www.w3.org/TR/html401/interact/forms.html#adef-disabled
In IE8, when disabling the "A" element, the element seems to be grayed out, do not receive focus, but can be clicked.
Changed September 07, 2010 02:03AM UTC by comment:4
I am running into this problem as well - but only in Firefox.
If I turn an "A" element into a jQuery UI button, then disable the button, then click on the button then:
- in IE8, the buttons click event handler will not be invoked (good)
- in Firefox 3.6.8, the buttons click event handler will be invoked (bad)
Same behavior is experienced if the button is disabled with .attr("disabled", "disabled").
Here is my sample code:
<a href="#" id="a1">Test</a>
<script type="text/javascript">
$(function() {
$('#a1').button().button("option", "disabled", true).click(function() { alert("clicked") });
});
</script>
Changed September 07, 2010 03:12AM UTC by comment:5
It seems the "disabled" attribute of the "A" element does not prevent the click action
in IE8.0.6001.18943, Chrome 6.0.472.53, Safari 3.2.2(525.28.1), Firefox 3.6.6, Opera 10.53.
<a href="about:blank" id="a1" target="_blank" onclick="alert('obtrusive')" disabled="disabled">Test</a>
But it seems ".button({ disabled: true })" prevent the click action in IE8, not in other browsers.
$('#a1').button({ disabled: true });
jQuery( or jQuery UI) code may prevent the click action in IE8.
The "disabled" attribute of the "A" element (half-implemented in IE) may have something to do with this behavior.
alert( $("#a1").attr("disabled") === true )
- In IE8, this code shows "true".
- In other browsers, this code shows "false".
Changed September 09, 2010 04:34AM UTC by comment:6
jQuery UI code may prevent the click action in IE8.
<A class="ui-button" disabled="disabled" onclick="alert('obtrusive')" href="about:blank" target="_blank">test</A>
Changed October 19, 2010 03:36PM UTC by comment:7
priority: | critical → major |
---|
Changed May 17, 2011 03:01PM UTC by comment:8
I could not reproduce this issue with jQuery UI 1.9pre Live from Git Tue May 17 14:55:04 UTC 2011.
Changed May 17, 2011 03:24PM UTC by comment:9
resolution: | → duplicate |
---|---|
status: | new → closed |
Changed May 17, 2011 03:24PM UTC by comment:10
Duplicate of #5945.
Changed October 11, 2012 09:15PM UTC by comment:11
milestone: | TBD |
---|
Milestone TBD deleted
It seems to need something like this: