3 examples of 'remove readonly attribute jquery' in JavaScript

Every line of 'remove readonly attribute 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
386setReadOnly(el: Element, readonly: boolean): void {
387 const cl = el.classList;
388 (readonly ? cl.add : cl.remove).call(cl, "_readonly");
389}
4function readonly(elements, selector, parent)
5{
6 control.call(this, elements, selector, parent);
7 Object.defineProperty(this, "__elements", {value: Array.prototype.slice.call(parent.__element.querySelectorAll(selector)), configurable: true});
8 this.__binder.defineDataProperties(this,
9 {
10 attributes:
11 {
12 get: function(){return this.__attributes;},
13 set: function(value)
14 {
15 if (value!==undefined&&value.isObserver) value=value();
16 this.__attributes=value;
17
18 if (value!==undefined)
19 for(var key in value)
20 {
21 each(this.__elements, function(element){element.setAttribute("data-"+key, value[key]);});
22 this.__element.setAttribute("data-" + key, value[key]);
23 }
24 }
25 },
26 disabled: {get: function(){return this.__element.disabled;}, set: function(value){each(this.__elements, function(element){element.disabled = !(!value);}); this.__element.disabled=!(!value);}},
27 display: {get: function(){return this.__element.style.display=="";}, set: function(value){this[value?"show":"hide"]();}},
28 enabled: {get: function(){return !this.__element.disabled;}, set: function(value){each(this.__elements, function(element){element.disabled = !value;}); this.__element.disabled=!value;}},
29 tooltip: {get: function(){return this.__element.title;}, set: function(value){var val = value&&value.isObserver?value():(value||""); each(this.__elements, function(element){element.title = val;}); this.__element.title = val;}},
30 value: {get: function(){return this.__element.innerHTML;}, set: function(value){var val = value&&value.isObserver?value():value; each(this.__elements, function(element){element.innerHTML = val;}); this.__element.innerHTML = val;}}
31 });
32}
79var toggleReadOnly = function toggleReadOnly(target, value) {
80 if (value === undefined) {
81 value = !target.hasAttribute('readonly');
82 }
83
84 if (value) {
85 setReadOnly(target);
86 } else {
87 unsetReadOnly(target);
88 }
89};

Related snippets