How To Replace < with> with > using jquery

前端 未结 10 753
鱼传尺愫
鱼传尺愫 2020-12-13 20:14

I have a page that is part of a backend CRM admin panel. On that page the HTML output comes from some PHP functions that I can\'t access. And that HTML automatically changes

相关标签:
10条回答
  • 2020-12-13 21:09

    Please try this

    .replace(/&lt;/g, '<').replace(/&gt;/g, '>') 
    

    to replace these characters globally. I tried this and works like a charm :)

    0 讨论(0)
  • 2020-12-13 21:09

    if use underscore.js exist _.unescape(string)

    0 讨论(0)
  • 2020-12-13 21:09

    You can do it simply with php

    <?php
    $a =
     '<div style="font-size: 11px; width: 90%; font-family: Tahoma;" id="cotiz">&lt;strong&gt;Valuación&lt;/strong&gt; de InfoAuto: 35.500,00&lt;br /&gt; 
    Cotización Seleccionada: Ninguna&lt;br /&gt; 
    Allianz, Responsabilidad Civil: $205,25&lt;br /&gt; 
    Allianz, Terceros Completos: $278,85 </div>';
    
    $b = html_entity_decode($a);
    
    
    echo $b;
    ?>
    
    0 讨论(0)
  • 2020-12-13 21:14

    The simplest thing to do would be

    $('#test').each(function(){
        var $this = $(this);
        var t = $this.text();
        $this.html(t.replace('&lt','<').replace('&gt', '>'));
    });
    

    working edit/jsfiddle by Jared Farrish

    0 讨论(0)
提交回复
热议问题