HTML-encoding lost when attribute read from input field

前端 未结 25 3814
时光说笑
时光说笑 2020-11-21 04:04

I’m using JavaScript to pull a value out from a hidden field and display it in a textbox. The value in the hidden field is encoded.

For example,



        
25条回答
  •  野的像风
    2020-11-21 04:55

    If you want to use jQuery. I found this:

    http://www.jquerysdk.com/api/jQuery.htmlspecialchars

    (part of jquery.string plugin offered by jQuery SDK)

    The problem with Prototype I believe is that it extends base objects in JavaScript and will be incompatible with any jQuery you may have used. Of course, if you are already using Prototype and not jQuery, it won't be a problem.

    EDIT: Also there is this, which is a port of Prototype's string utilities for jQuery:

    http://stilldesigning.com/dotstring/

提交回复
热议问题