Created
February 1, 2012 22:50
-
-
Save KruegerDesigns/1719961 to your computer and use it in GitHub Desktop.
Wrap contents of a tag in a span, or other tag.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Used to style ol li items when applied by a WYSIWYG editor. | |
$("#content ol li").each(function(){ | |
$(this).contents().wrap("<span>"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you need help visualizing the usefulness of this, here's a screen shot: http://d.pr/8QjU
I needed this script when I was developing styles for a CMS Website. The editor the client would use has options for adding styles, and you could carefully instruct the WYSIWYG editor to create a div in each list item, or "li", but... that's just unrealistic to expect a client to figure out and get right.
With this JS you can create the styles and whenever the client adds an ordered list, or "ol", everything just works.
-Adam