jQuery的实现编码,解决特殊字符 <script> "

function htmlEncode(value){
    if (value) {
        return jQuery('<div />').text(value).html();
    } else {
        return '';
    }
}
 
function htmlDecode(value) {
    if (value) {
        return $('<div />').html(value).text();
    } else {
        return '';
    }
}

  

猜你喜欢

转载自www.cnblogs.com/xbding/p/9711744.html
今日推荐