Yip:
$(this).removeClass('er-green'); $(this).addClass('er-red');
Or remove them all first:
If a class name is included as a parameter, then only that class will be removed from the set of matched elements. If no class names are specified in the parameter, all classes will be removed.
$(this).removeClass(); $(this).addClass('er-red');
Related Posts:
- How to change CSS using jQuery?
- How can I scroll to an element using jQuery?
- Bootstrap Dropdown menu is not working
- Change Background color (css property) using Jquery
- Set timeout for ajax (jQuery)
- How to generate a simple popup using jQuery
- Use images like checkboxes
- Adding images to a Bootstrap Carousel with AJAX
- Setting background-image using jQuery CSS property
- Uncaught TypeError: Cannot read property ‘top’ of undefined
- Equivalent of jQuery .hide() to set visibility: hidden
- TypeError: $(…).modal is not a function with bootstrap Modal
- Why is the jquery script not working?
- TypeError: $(…).DataTable is not a function
- Change text on hover, then return to the previous text
- Refresh/reload the content in Div using jquery/ajax
- How to get height of div in px dimension
- How to display raw JSON data on a HTML page
- “Uncaught TypeError: a.indexOf is not a function” error when opening new foundation project
- Why is jquery show() not working in example
- jQuery scrollTop() method not working
- Fully responsive HTML5 video
- How to change cursor from pointer to finger using jQuery?
- How can I remove a style added with .css() function?
- How to use aria-expanded=”true” to change a css property
- How to set “style=display:none;” using jQuery’s attr method?
- Uncaught ReferenceError: jQuery is not defined [duplicate]
- syntax error: unexpected token <
- Error OPTIONS net::ERR_CONNECTION_REFUSED
- Uncaught ReferenceError: jQuery is not defined [duplicate]
- Cannot read property ‘push’ of undefined when combining arrays
- How to deal with net::ERR_SSL_PROTOCOL_ERROR?
- Scroll to an element with jQuery
- Download File Using JavaScript/jQuery
- Check if checkbox is checked with jQuery
- Getting Error “Form submission canceled because the form is not connected”
- jQuery get textarea text
- How can jQuery deferred be used?
- Uncaught TypeError : cannot read property ‘replace’ of undefined In Grid
- Disable/enable an input with jQuery?
- What does on() in JavaScript do?
- JavaScript error (Uncaught SyntaxError: Unexpected end of input)
- Angular: conditional class with *ngClass
- ChangeDate – Date Picker Bootstrap
- Uncaught TypeError: Cannot read property ‘msie’ of undefined
- How to hide a div with jQuery?v
- How do I set/unset a cookie with jQuery?
- Failed to load resource: net::ERR_CONTENT_LENGTH_MISMATCH
- With jQuery, how do I capitalize the first letter of a text field while the user is still editing that field?
- How to add multiple classes to a ReactJS Component?
- How to update array value javascript?
- jQuery explode string like PHP
- Validate date in dd/mm/yyyy format using JQuery Validate
- CSS Animation onClick
- Simulate Keypress With jQuery
- Adding options to a
- jQuery Ajax POST example with PHP
- Setting and getting localStorage with jQuery
- Javascript isnull
- Set value to currency in
- Uncaught TypeError: Cannot read property ‘toUpperCase’ of undefined
- SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
- HTML Entity Decode
- jQuery remove options from select
- jquery beforeunload when closing (not leaving) the page?
- How do I pass the this context to a function?
- Escaping HTML strings with jQuery
- How to use z-index in svg elements?
- What is the best way to detect a mobile device?
- How to filter JSON Data in JavaScript or jQuery?
- Get querystring from URL using jQuery [duplicate]
- jQuery checkbox change and click event
- jQuery selectors on custom data attributes using HTML5
- How do I refresh a DIV content?
- TypeError: abc.getAttribute is not a function
- jQuery sort elements using data id
- getContext is not a function
- How to fire an event on class change using jQuery?
- Change an image with onclick()
- navigator.geolocation.getCurrentPosition sometimes works sometimes doesn’t
- Uncaught SyntaxError: Unexpected token with JSON.parse
- How to open a Bootstrap modal window using jQuery?
- window.location.replace() not working to redirect browser
- jquery to validate phone number
- Closing Bootstrap modal onclick
- What’s a Good Javascript Time Picker?
- Cannot read property ‘preventDefault’ of undefined in javascript error
- WordPress Bootstrap Handburger Menu Wont Open
- WordPress 5.5 – ReferenceError: commonL10n is not defined error
- Slider loading issue
- Jquery function working in Chrome Console but not in the code [closed]
- List of JS Events for Widgets?
- Getting a ‘slide down’ js panel implemented within WP
- Uncaught ReferenceError: jQuery is not defined – although jQuery is loaded [closed]
- Change each text after 4 second and each image after 2 second
- wp post_tag change minlength
- How to locate the js code and php code for certain function?
- Change the version of default style.css in wordpress
- WP Media Uploader modal conflicts with Bootstrap modal
- Access jQuery tabs from primary menu while adding/removing class on tab container elements (accessing diff. tabs/tab content via primary menu items)