7 examples of 'jquery addattr' in JavaScript

Every line of 'jquery addattr' 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
34function addAttr(namespace, key, val) {
35 var ns = map[namespace] || (map[namespace] = {});
36 ns[key] = val;
37}
394function replace_attr( $el, attr ) {
395 $el.each( function() {
396 var str = $( this ).attr( attr );
397 $( this ).attr( attr, str.replace( old_index, index ) );
398 } );
399};
338function replace_attr( $el, attr ) {
339 $el.each( function() {
340 var str = $( this ).attr( attr );
341 $( this ).attr( attr, str.replace( old_index, index ) );
342 } );
343};
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}
205function indexArrayByAttr(inArray, attr) {
206 inArray.forEach( function(elem,ignore,arr){
207 // Add a named alias to each entry.
208 if (isValid(elem[attr]) && !isValid(arr[elem[attr]])) {
209 Object.defineProperty(arr, elem.id, { value : elem, enumerable:false });
210 }
211 else { console.log("Duplicate or missing "+attr+" attribute in array: "+elem[attr]); }
212}); }
90function attr(target:HTMLElement, attrName:string, attrValue:string): void {
91 target.setAttribute(attrName, attrValue);
92}
12function setAttr(el, name, value) {
13 if(typeof name === 'object') return _.extend(el.attribs, name);
14
15 if(value === null) {
16 removeAttribute(el, name);
17 } else {
18 el.attribs[name] = encode(value);
19 }
20
21 return el.attribs;
22}

Related snippets