disabled

Jump to: navigation, search



Applies to  ?

Examples

View live exampleThis example uses the disabled property to enable or disable a style object and a control.

<style type="text/css" id="oStyle">
.styletest {
     background-color: black;
     color: white;
}
.styletest2 {
     background-color: black;
     color: red;
}
</style>
<script type="text/javascript">
function fnSwitch(){
     if(oTest.enablement=="enabled"){
          // Use an arbitrary attribute to track the status.
          oTest.enablement="disabled";
          oButton.value="Set disabled to false";
          oStyle.disabled=true;
          oDisableMe.disabled=true;
     }
     else{
          oButton.value="Set disabled to true";
          oTest.enablement="enabled";
          oStyle.disabled=false;
          oDisableMe.disabled=false;
     }
}
</script>
...     
     <p enablement="enabled" id="oTest" class="styletest">
     A paragraph of text.
          <input type="button" id="oDisableMe" class="styletest" value="Demonstration Button" onclick="alert('Demonstration button')">
     </p>
     <input type="button" id="oButton" value="Set disabled to true" onclick="fnSwitch()">

Notes

Remarks

When an element is disabled, it appears dimmed and does not respond to user input. Disabled elements do not respond to mouse events, nor will they respond to the contentEditable property. If an element's disabled property is set to false but it is contained within a disabled element, it cannot override the disabled state of its container. For link, style and styleSheet, the attribute sets or retrieves whether a style sheet is applied to the object. Note  For OPTGROUP and OPTION, the functionality specified by the HTML 4.01 standard is not currently implemented. You can define your own functionality.

Syntax

See also

Related articles

html


















































warning.png"html" is not in the list of possible values (Canvas, CSS Font, CSS Layout, Animation, Audio, Background, Border, Box Model, CSS Attributes, CSSOM, Combinators, Deprecated, Document Structure, Exclusions, FileSystemAPI, Filters, Flexbox, Fonts, Generated and Replaced Content, Gradients, Grid Layout, HTML, Multimedia, Media Queries, Mobile, Multi-Column, Off-line Storage, Paged Media, Performance, Pointer Events, Pseudo-Classes, Pseudo-Elements, Regions, Responsive Web Design, Ruby, Scrollbar, Selectors, Security, Syntax, Tables, Text, Touch, Transforms, Transitions, Video, Visual Effects, Web Components, WebRTC, XHR) for this property.


Related pages (MSDN)

  • button
  • input type=button
  • input type=checkbox
  • input type=file
  • input type=image
  • input type=password
  • input type=radio
  • input type=reset
  • input type=submit
  • input type=text
  • select
  • textArea
  • link
  • style
  • styleSheet
  • optGroup
  • option
  • disabled

This article contains content originally from external sources.

Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]