我需要从标记中删除单引号,因为它与页面上的某些javascript功能冲突。对我来说,最好的方法是什么?
<span class="field-content" data-live-anchor="jes's-mon">Group A</span>
答案 0 :(得分:0)
这有助于您:
<html>
<head>
</head>
<body>
<span class="field-content" data-live-anchor="jes's-mon">Group A</span>
<script>
var ele = document.getElementsByClassName("field-content")[0];
str = ele.getAttribute("data-live-anchor");
var newStr = str.replace(/\'/gmi,'');
alert(newStr);
</script>
</body>
</html>