Skip to content

Instantly share code, notes, and snippets.

@jameswbutts
jameswbutts / format-wysiwyg.js
Created March 21, 2012 15:07
JQuery to apply classes to floated wysiwyg images
/**
* Applies .left or .right to images with inline floats.
* Useful for wysiwyg editors that use inline styles for alignment.
* Wrap wysiwyg output in a class to target (.wysiwyg)
*/
$(document).ready(function(){
$(".wysiwyg img").each(function(index, value) {
if( $(this).css('float')=='left' ){
$(this).addClass("left");
}else if( $(this).css('float')=='right' ){