Multiple Condition In .each JQuery August 29, 2022 Post a Comment Here is my HTML Name: < Solution 1: As simple as one line with toggleClass: $('.sp-right, .sp-left').toggleClass("sp-right sp-left"); Copy No need to check for classes and remove/addClass manually, as toggleClass does exactly this. You can also provide multiple space separated classes to toggle. Solution 2: Check the current classname inside the function. $(".sp-left, .sp-right").each(function(){ var el = $(this); if (el.hasClass('sp-left')) { el.removeClass("sp-left").addClass("sp-right"); } else { el.removeClass("sp-right").addClass("sp-left"); } }); Copy Share Post a Comment for "Multiple Condition In .each JQuery" Top Question What Substitute Should We Use For LayerX/layerY Since They Are Deprecated In Webkit? In chrome canary, layerX and layerY are deprecated, but wha… How To Clear Specific Line In Canvas : HTML5 I am totally new to this Canvas Element. I am able to draw … How Can I Attach Event To A Tag Which Is In String Form? I'm creating html on runtime like this: var myVar = … Reading In A File From Ubuntu (AWS EC2) On Local Machine? I have a python script which I'm running on AWS (EC2 in… Difference Between Using Ui-sref And Href(where To Use) In Ionic Framework Using Ui-router Service I am working on ionic framework. So I am confused with usin… How To Check If Input Type Button Is Pressed In Php? The isset() function can be used to check if the input type… Testing Redux Thunk Action Creator I've got a redux action creator that utilizes redux-thu… Show Map On Bootstrap Modal I want to show a new google map on a bootstrap modal but it… Google Maps Api V3: Turning User Input Coordinates To Latlng? I'm new with Google Maps. I'm trying to turn coordi… JS: Call A Function After Another Without Touching The Original Function? I am trying to extend a third party library on a specific p… December 2024 (1) November 2024 (38) October 2024 (69) September 2024 (21) August 2024 (374) July 2024 (338) June 2024 (690) May 2024 (1296) April 2024 (804) March 2024 (1507) February 2024 (1653) January 2024 (1302) December 2023 (1310) November 2023 (374) October 2023 (573) September 2023 (298) August 2023 (353) July 2023 (281) June 2023 (388) May 2023 (200) April 2023 (136) March 2023 (137) February 2023 (163) January 2023 (277) December 2022 (133) November 2022 (231) October 2022 (170) September 2022 (167) August 2022 (494) July 2022 (275) June 2022 (268) Menu Halaman Statis Beranda © 2022 - JavaScript Accelerator