10 examples of 'jquery get multiple attribute values' in JavaScript

Every line of 'jquery get multiple attribute values' 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
239function extractValue ($, attribute) {
240 if ($ && $.length) {
241 return $.attr(attribute) || undefined
242 }
243 return undefined
244}
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

206function attr(elm, attrName, val) {
207 if (typeof val == 'undefined') {
208 if (tracking.isIe) {
209 try {
210 return elm.getAttribute(attrName, 2)
211 } catch (e) {}
212 }
213 return elm.getAttribute(attrName);
214 }
215 elm.setAttribute(attrName, val);
216}
112setValues(values) {
113 this._emitChanges = false;
114 if (this._slider) {
115 this._frames = [];
116 for (const [start, end] of values.association.segments) {
117 for (let i = start; i <= end; i++) {
118 this._frames.push(i);
119 }
120 }
121 this._slider.value = 0;
122 this._slider.max = this._frames.length - 1;
123 }
124 for (const widget of this._div.children) {
125 const name = widget.getAttribute("name");
126 const value = values.attributes[name];
127 // Only set the name if it is defined
128 if (value != undefined)
129 {
130 widget.setValue(values.attributes[name]);
131 }
132 }
133 this._emitChanges = true;
134}
96function attr(element, name) {
97 return element.getAttribute(name);
98}
21function _getAttr(el, key) {
22 key = key.toLowerCase();
23 var val = null;
24 // IE6,IE7,IE=EmulateIE7
25 if (!_GET_SET_ATTRIBUTE && el.nodeName.toLowerCase() != 'script') {
26 var div = el.ownerDocument.createElement('div');
27 div.appendChild(el.cloneNode(false));
28 var list = _getAttrList(_unescape(div.innerHTML));
29 if (key in list) {
30 val = list[key];
31 }
32 } else {
33 // IE8设置<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />,抛出异常
34 try {
35 val = el.getAttribute(key, 2);
36 } catch(e) {
37 val = el.getAttribute(key, 1);
38 }
39 }
40 if (key === 'style' && val !== null) {
41 val = _formatCss(val);
42 }
43 return val;
44}
7export function attr(attrName) {
8 return this._el[0].getAttribute(attrName);
9}
434export function getAttribute(el, attribute) {
435 return el.getAttribute(attribute);
436}
422function getAttribute(self, name) {
423 return self._attributes[name];
424},
51function getAttrs(el) {
52 var attrs = {};
53
54 var _ref = el.style || {},
55 width = _ref.width,
56 maxWidth = _ref.maxWidth,
57 padding = _ref.padding;
58
59 var ww = (0, _convertToCSSPTValue2.default)(width) || (0, _convertToCSSPTValue2.default)(maxWidth);
60 var pp = (0, _convertToCSSPTValue2.default)(padding);
61 if (ww) {
62 attrs.width = ww;
63 }
64 if (pp) {
65 attrs.padding = pp;
66 }
67
68 console.log('getAttrs', el);
69
70 attrs.layout = el.getAttribute(ATTRIBUTE_LAYOUT) || LAYOUT.US_LETTER_PORTRAIT;
71 return attrs;
72}
456getValues(attributeName) {
457 const arg = this.args[attributeName];
458 return arg ? arg.values : null;
459}

Related snippets