HTML
<div id = "board_code_dup">
<div>{abc</div>
<div>def</div>
div>ghi}</div>
</div>
JS
var $board_code_dup = $('#board_code_dup');
board_code_dup_html = $board_code_dup.html();
$board_code_dup.html( board_code_dup_html.replace(/{/g, "<span>{</span>") );
$board_code_dup.html( board_code_dup_html.replace(/}/g, "<span>}</span>") );
的所有实例}
都被正确替换为<span> } </span>
但不是{
。
我的代码有什么问题?