清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
这段代码用于清除指定元素对象内的html代码,相当于stripHtml函数,代码被定义成了jquery插件的形式,调用起来非常方便。
(function($) {
$.fn.stripHtml = function() {
var regexp = /<("[^"]*"|'[^']*'|[^'">])*>/gi;
this.each(function() {
$(this).html( $(this).html().replace(regexp,'') );
});
return $(this);
}
})(jQuery);
$('p').stripHtml();