[英]Javascript Regex replace not working in IE10
以下JS在FF中可以正常工作,但不能替代IE10中的任何內容:
var pattern = new RegExp('<span id=\"(.+?)\" class=\"questiontext\"><p(.*?)>(.+?)<\/p><\/span>', 'gim');
$('.questiontext_div').html(function(index, html) { return html.replace(pattern,'<span id="$1" class="questiontext"><legend>$3</legend></span>'); });
我試圖用圖例替換p。
<div class="questiontext_div">
<span id="C00B7205241531FD2BEF31301000101F0DESC" class="questiontext">
<P style="font-weight: bold; color: #005881;">Text will go here!</P>
</span>
</div>
這可能會更簡單:
$('span.questiontext p').replaceWith('<legend...etc>');
並在所有瀏覽器上工作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.