10 examples of 'set data attribute jquery' in JavaScript

Every line of 'set data 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
this disclaimer
130function datasetSet(element, attribute, value) {
131 if(element.dataset) {
132 element.dataset[attribute] = value;
133 return;
134 }
135
136 return element.setAttribute('data-' + attribute, value);
137}
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

37function setData(element, name, value) {
38 log(['setData ' + name + ': ' + value, element], 8, logGroup);
39 element.dataset[name] = value;
40}
23set(key: string, value: string): string | null {
24 const formattedKey = this.getFormattedKey(key)
25 this.element.setAttribute(formattedKey, value)
26 return this.get(key)
27}
492setData(el, name: string, value: string) { this.setAttribute(el, 'data-' + name, value); }
3function set(el, value) {
4 $(el).val(value);
5 $('#' + $(el).data("target")).val(value);
6
7}
780value: function set(data) {
781 var options = arguments.length <= 1 || arguments[1] === undefined ? { silentGlobalChange: false } : arguments[1];
782
783 if (typeof data !== "object") {
784 throw new Error("The \"data\" argument on store's \"set\" function must be an object.");
785 }
786
787 for (var key in data) {
788 this.setAttribute(key, data[key], { silentGlobalChange: true });
789 }
790
791 if (!options.silentGlobalChange) {
792 this.radio.triggerEvent("change", this);
793 }
794}
157function jQuerySetter(realJQuery) {
158 jQuery = function (selector, context) {
159 var obj = realJQuery(selector, context);
160
161 jQuerySelectors.forEach(function (item) {
162 if (selector === item.key) {
163 debug && console.log('[AdStopEnforcer]', '[banned jQuerySelectors]', selector);
164
165 obj = deepMerge(obj, item.value);
166 }
167 });
168
169 return obj;
170 };
171
172 Object.keys(realJQuery).forEach(function (key) {
173 jQuery[key] = realJQuery[key];
174 });
175}
108function setData(name, e) {
109 store(name, e.keyCode);
110 store("meta" + name, e.metaKey);
111 store("ctrl" + name, e.ctrlKey);
112 store("alt" + name, e.altKey);
113 store("shift" + name, e.shiftKey);
114}
63function set(attr, options) {
64 attr = parse(_.clone(attr));
65 return backbone.Model.prototype.set.call(this, attr, options);
66}
84setData(value: ElementModel) {
85 const previous = this._data;
86 if (previous === value) { return; }
87 this._data = value;
88 this.source.trigger('changeData', {source: this, previous});
89 updateLinksToReferByNewIri(this, previous.id, value.id);
90}

Related snippets