使用javascript从标题中删除html标记

时间:2016-11-18 23:01:17

标签: javascript jquery html

我有一个Javascript函数,当前覆盖了一个html显示,允许更长的标题显示在程序替换字符串规则上,它可以正常工作。我看到的问题虽然它确实有效,但html标签显示在标题中:

所以在文件夹结构中它显示如下(这是正确的):聚合定价项目测试 - foo

但在详细页面标题中,脚本执行后会显示如下:

 Aggregated Pricing Item Test - <b>foo</b>

有没有改变现有的javascript来使用或消除它显示html元素?

以下是我们用于覆盖的代码:

 <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="jSINI.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {
    var doc_id = CallSINIMethod("GetValue",["SystemProperty","CurrentUserDocument", null]);
    var int_id = CallSINIMethod("GetValue",["DocumentProperty","ProductID", doc_id]);
    var prod_name = CallSINIMethod("GetValue",["ProductProperty","DisplayName", int_id]);
    $('div.areaTitle').text(prod_name);
    });
    </script> 

1 个答案:

答案 0 :(得分:1)

因为您使用的是// Form the Basic Authentication header - needs Base64 encoding as cUrl would do. var TOKEN = Utilities.base64Encode("sean@seansean.com/token:vss0keykeykey"); var options = { "method" : "GET", "contentType" : "application/json", "headers" : { // No need for the "Bearer" prefix "Authorization" : TOKEN } }; 属性,它会准确显示您提供的内容,您需要将其更改为text,以便正确显示。

html
相关问题