getPropertyPriority method
9 | ||||
Retrieves the priority of specified style property (the 'important' qualifier).
Note: The getPropertyValue method is supported in Internet Explorer from version 9.
The important qualifier can be set for a style property in CSS, or by the setProperty method.Syntax:
You can find the related objects in the Supported by objects section below.
Return value:
String. One of the following values:
Important qualifier is set. | |
Important qualifier is not set. |
Example HTML code 1:
This example illustrates the use of the getPropertyPriority method:
|
||||
<head> <style> #myDiv { width:200px !important; } </style> <script type="text/javascript"> function GetPriority () { var sheet = document.styleSheets[0]; var rules = sheet.cssRules ? sheet.cssRules : sheet.rules; var rule = rules[0]; if (rule.style.getPropertyPriority) { var priority = rule.style.getPropertyPriority ("width"); alert (priority); } else { // Internet Explorer before version 9 alert ("Your browser does not support this example!"); } } </script> </head> <body> <div id="myDiv">A div element</div> <button onclick="GetPriority ()">Get priority!</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
CSSStyleDeclaration, htmlElement.currentStyle, htmlElement.style
HTML elements:
a, abbr, acronym, address, applet, area, b, base, basefont, bdo, bgsound, big, blink, blockquote, body, br, button, caption, center, cite, code, col, colgroup, comment, dd, del, dfn, dir, div, dl, dt, em, embed, fieldset, font, form, frame, frameset, h1, h2, h3, h4, h5, h6, head, hr, html, i, iframe, img, input:button, input:checkbox, input:file, input:hidden, input:image, input:password, input:radio, input:range, input:reset, input:search, input:submit, input:text, ins, isindex, kbd, keygen, label, legend, li, link, listing, map, marquee, menu, meta, nobr, noframes, noscript, object, ol, optgroup, option, p, param, plaintext, pre, q, rt, ruby, s, samp, script, select, small, span, strike, strong, style, sub, sup, table, tbody, td, textarea, tfoot, th, thead, title, tr, tt, u, ul, var, wbr, xml, xmp
Related pages:
External links:
User Contributed Comments