You can do this :
$('.toggle').click(function () {
var classes = ['class1','class2','class3'];
$('div').each(function(){
this.className = classes[($.inArray(this.className, classes)+1)%classes.length];
});
});
More Related Contents:
- Substraction two textbox values with jquery [duplicate]
- How to get the children of the $(this) selector?
- Getting the ID of the element that fired an event
- jQuery $(document).ready and UpdatePanels?
- Remove array element based on object property
- Javascript – arrow functions this in event handler?
- Detect all changes to a (immediately) using JQuery
- Is it possible to clone html element objects in JavaScript?
- Resize event for textarea?
- Using jQuery to find an element at a particular position?
- Is there a way to round numbers into a reader friendly format? (e.g. $1.1k) [closed]
- jQuery: how to change tag name?
- Best way to store a key=>value array in JavaScript?
- jQuery – Increase the value of a counter when a button is clicked
- Am I using too much jQuery? When am I crossing the line?
- use jQuery to get values of selected checkboxes
- Calling ASP.NET Code Behind function from JavaScript
- Fullpage.js. Adding a scroll delay
- Using JQuery to bind “focus” and “blur” functions for “window”, doesn’t work in IE
- Convert dropdown to selection boxes with color and trigger drop down action
- Allow text box only for letters using jQuery?
- minimise the code since I am using the same code only the content in p tags changes and component AccordionHeader header changes
- Rotate div text after clicking on button using jquery and css
- How to select all textareas and textboxes using jQuery?
- let user scrolling stop jquery animation of scrolltop?
- Hot to get incomplete datetime-local input values
- Prevent a link to reload page
- jQuery: Count words in real time
- Do duplicate ID values screw up jQuery selectors?
- How to determine if the client is a touch device [duplicate]