{"version":"1.0","type":"rich","title":"Gist 2654204","description":"This example demonstrates how to dynamically swap CSS class names on DOM elements using a jQuery plugin. It shows a reusable `replaceClass` method that leverages the native `String.replace` function, accepting either a regexp or substring as the old class and a string or function as the replacement. The plugin iterates over each matched element via `this.each`, modifying the `class` attribute through jQuery’s `attr` callback. The code relies on jQuery’s core APIs, specifically `$.fn.each` and `$.fn.attr`, to perform the replacement without altering other attributes or event handlers. The data source is the element’s existing class attribute, and the rendering approach is direct DOM manipulation.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-2654204?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}