Created
July 16, 2015 11:48
-
-
Save dorthrithil/a4fff5d1d8b8bfe8e571 to your computer and use it in GitHub Desktop.
A simple function which removes all styles from text pasted from Word or Browsers.
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
// created for use in textAngulars ta-paste="modifyHtml($html)" option | |
// http://textangular.com/ | |
$scope.modifyHtml = function($html){ | |
var DOMTree = jQuery(jQuery.parseHTML($html, null, false)); | |
jQuery.each(DOMTree, function(key, value){ | |
jQuery(value).removeAttr('style').find('*').removeAttr('style').removeClass(); | |
}); | |
return jQuery('<div>').append(DOMTree).html(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment