Escape quotes in JavaScript

前端 未结 13 852
不思量自难忘°
不思量自难忘° 2020-11-22 11:39

I\'m outputting values from a database (it isn\'t really open to public entry, but it is open to entry by a user at the company -- meaning, I\'m not worried about XSS).

13条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-22 11:58

    I have done a sample one using jQuery

    var descr = 'test"inside"outside';
    $(function(){
       $("#div1").append('Click Me');       
    });
    
    function DoEdit(desc)
    {
        alert ( desc );
    }
    

    And this works in Internet Explorer and Firefox.

提交回复
热议问题