我需要在DIV中突出显示多个字符串。这是我当前的脚本,设置为加下划线,但是从不改变。
<script type="text/javascript">
$("div:contains('set to')").each(function()
{
var $el = $(this);
$el.html( $el.html().replace(/set to/g, '<span style="text-decoration: underline">SET</span> to') );
});
$("div:contains('changed from')").each(function()
{
var $el = $(this);
$el.html( $el.html().replace(/changed from/g, '<span style="text-decoration: underline">changed from</span>') );
});
</script>