replace - jQuery - Remove comma from class names -
i have divs have have 2 classes comma in between them. did not code hand, generated webapp. remove commas in class attribute , replace them space. how accomplish this? have multiple classes, have search character , replace character only.
.each(function() { var $el = $(this), n = $el.attr("class").match(/cat-item-(.*)/)[1]; $el.addclass(n); });
jquery('whatever_youre_searching_to_update').each(function() { var _scurrclasses = jquery(this).attr('class'); jquery(this).attr('class', _scurrclasses.replace(/,/g, ' ')); });
jquery replace attributes
No comments:
Post a Comment