- (function($) {
- $.fn.striphtml = function() {
- var regexp = /<("[^"]*"|'[^']*'|[^'">])*>/gi;
- this.each(function() {
- $(this).html(
- $(this).html().replace(regexp,"")
- );
- });
- return $(this);
- }
- })(jQuery);
- //用法
- $('p').stripHtml();
- //该片段来自于http://www.codesnippet.cn/detail/22112012604.html
来源: http://www.codesnippet.cn/detail/22112012604.html