HTML-encoding lost when attribute read from input field

前端 未结 25 3902
时光说笑
时光说笑 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:50

    Prototype has it built-in the String class. So if you are using/plan to use Prototype, it does something like:

    '
    This is an article
    '.escapeHTML(); // -> "<div class="article">This is an article</div>"

提交回复
热议问题