jQuery实现PHP的htmlspecialchars的功能 var mytext = "<hello http://baidu.com>"; $("<div/>").text(mytext).html();