10 examples of 'jquery remove class onclick' in JavaScript

Every line of 'jquery remove class onclick' 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
91function removeAllElementClass(className){
92 $("."+className, window.parent.document).removeClass(className);
93}
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

164function removeClass(e, name) {
165 /* Removes the class "name" from the element "e"s class list */
166
167 e.className = e.className.replace(new RegExp("\\b" + name + "\\b\\s*", "g"), "");
168}
10function onClick(event) {
11 // check if div has large class
12 if(div.classList.contains("large")) {
13 div.classList.remove("large");
14 div.classList.add("small");
15 } else {
16 div.classList.add("large");
17 div.classList.remove("small");
18 }
19}
42function removeClass(className) {
43 this.classList.remove(className);
44
45 return this;
46}
44export function removeClass(element, classname) {
45 if(element && classname) {
46 while(element.className.indexOf(classname) >= 0) {
47 element.className = element.className.replace(classname, '');
48 }
49 }
50};
138export function removeClass(domEl, strClassNamesToRemove) {
139 let domClasses = ' ' + domEl.className + ' ';
140 let arrClassesToRemove = strClassNamesToRemove.split(/\s+/);
141
142 arrClassesToRemove.forEach((className) => {
143 domClasses = domClasses.replace(' ' + className + ' ', ' ');
144 });
145
146 domEl.className = domClasses.replace(/^\s+|\s+$/g, '');
147}
8function toggle(_btn, _div) {
9 var elem = document.getElementById(_div);
10
11 if(elem.style.display === 'none') {
12 elem.style.display = 'block'
13 _btn.innerHTML = "-";
14 }
15 else {
16 elem.style.display = 'none'
17 _btn.innerHTML = "+";
18 }
19}
72function $removeClass(el, c) {
73 if (el) el.classList.remove(c);
74}
921function remove_class(css_class, element) {
922 check_params(css_class, element, "remove_class");
923 var regexp = new RegExp("(\\s" + css_class + ")|(" + css_class + "\\s)|" + css_class, "i");
924 element.className = pklib.string.trim(element.className.replace(regexp, ""));
925}
148function removeButtonHandler() {
149
150 if (!confirm(_('admin.messages.item_delete_confirm'))) { return false; }
151 var $item = $(this).parents('.item').eq(0);
152 $item.remove();
153 $items = $itemsWrap.find('> .item');
154
155 update();
156
157 return false;
158
159}

Related snippets