MainelyDesign.com Blog

Remove Duplicate Span Tags from Jquery UI Buttons

Posted on 05/22/2014 at 10:22 pm by Kevin Wentworth
Viewed 8,942 times | 1 comment

I have a loader function that I call every time I need to update ajax-ed in content.  A funny thing was happening: the buttons kept growing bigger and bigger on each run of this function.  The culprit: additional span tags that were causing the CSS rules to be applied multiple times.  The fix: unwrap.

Remove Duplicate Spans from Jquery UI Buttons

  1. // remove duplicate button spans
  2. $('span.ui-button-text').parent('span.ui-button-text').find('span').unwrap();

Cheers,
-Kevin Wentworth

Bookmark and Share

Tags for Remove Duplicate Span Tags from Jquery UI Buttons

Web Programming | Jquery Ui | Jquery | Ui | Web Design

Comments for this Posting

Posted by Alvaro

on 10/6/14

Excellent solution!! Works like a charm.

Sorry, comments are closed for this posting.

Please Email Kevin if you have any questions. Thanks!

Meet Site Avenger - Hosted Content Management System

Powered By: Site Avenger | Site Production: Saco Design