How to decode HTML entities using jQuery?

后端 未结 19 2210
忘了有多久
忘了有多久 2020-11-21 23:21

How do I use jQuery to decode HTML entities in a string?

19条回答
  •  忘了有多久
    2020-11-21 23:43

    I just had to have an HTML entity charater (⇓) as a value for a HTML button. The HTML code looks good from the beginning in the browser:

    
    

    Now I was adding a toggle that should also display the charater. This is my solution

    $("#share_button").toggle(
        function(){
            $("#share").slideDown();
            $(this).attr("value", "Embed & Share " + $("
    ").html("⇑").text()); }

    This displays ⇓ again in the button. I hope this might help someone.

提交回复
热议问题