特定の文字列からタグを正常に削除する次のスクリプトがあります。しかし、問題は、script タグを削除しようとしないと、次の fun() 関数が自動的に script タグを削除してしまうことです。誰か私に説明してくれませんか?
<script src="jquery-1.8.3.js"></script>
<script>
function fun(x)
{
alert(x);
var html = $(x.bold());
html.find('p').remove();
return html.html();
//alert(html);
}
</script>
<input type="button" value="click" onclick="alert(fun('<script>hello script</script><p>hello p</p><div>hello div</div>'))">