10 examples of 'get style jquery' in JavaScript

Every line of 'get style jquery' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
8function getStyle(elementId, property)
9{
10 var element = document.getElementById(elementId);
11 return element.currentStyle ? element.currentStyle[property]
12 : document.defaultView.getComputedStyle(element, null).getPropertyValue(property);
13}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

7function getStyle (el, style) {
8 var ret
9 ,styleWords;
10
11 if (window.getComputedStyle) {
12 ret = window.getComputedStyle(el).getPropertyCSSValue(style).cssText;
13 } else {
14 // For IE
15 styleWords = style.split('-');
16 if (styleWords.length === 2) {
17 // ugly!
18 style = styleWords[0];
19 style += styleWords[1].match(/^./)[0].toUpperCase();
20 style += styleWords[1].split('').slice(1).join('');
21 }
22
23 ret = el.currentStyle[style];
24 }
25
26 return ret;
27}
354function getStyle(obj, attr) {
355 if (obj.currentStyle) {
356 return obj.currentStyle[attr];
357 }
358 else {
359 return getComputedStyle(obj, false)[attr];
360 }
361}
11function get_style(el,style_prop) {
12 var o = null;
13 if (el.currentStyle) {
14 o = el.currentStyle[style_prop];
15 } else if (window.getComputedStyle) {
16 o = document.defaultView.getComputedStyle(el,null).getPropertyValue(style_prop);
17 }
18 return o;
19}
115export function getStyle(element, styleName) {
116 if (!element || !styleName) return null;
117 styleName = camelCase(styleName);
118 if (styleName === 'float') styleName = 'cssFloat';
119
120 try {
121 var computed = document.defaultView.getComputedStyle(element, '');
122 return element.style[styleName] || computed ? computed[styleName] : null;
123 } catch (e) {
124 return element.style[styleName];
125 }
126}
27export function getStyle(el, styleProp) {
28 if (el.currentStyle) {
29 return el.currentStyle[camelize(styleProp)];
30 }
31 else if (document.defaultView && document.defaultView.getComputedStyle) {
32 return document.defaultView
33 .getComputedStyle(el, null)
34 .getPropertyValue(styleProp);
35 }
36 return el.style[camelize(styleProp)];
37}
237export function getStyle(el: any, attr: any): any {
238 let computedStyle = el['currentStyle'] ? el['currentStyle'] : window['getComputedStyle'](el);
239 if (!attr) {
240 return computedStyle;
241 } else {
242 return computedStyle[attr];
243 }
244}
40getStyle() {
41 return this.isRequired() ? this.getDimensions() : this.defaultStyle;
42}
74function _setStyle(obj, options) {
75 let len = obj.length;
76
77 while (len--) {
78 for (let property in options) {
79 obj[len].style[property] = options[property];
80 }
81 }
82 return obj.style;
83}
803function getStyle(el, style) {
804
805 return win.getComputedStyle(el, null).getPropertyValue(style);
806
807}

Related snippets