unterminated string literal error for a django template tag

后端 未结 1 1651
Happy的楠姐
Happy的楠姐 2021-01-18 21:23

I have the following snippet of code which gives me unterminated string literal error

$(function() {
             $(\'#addDropdown\').click(function() {
             


        
1条回答
  •  半阙折子戏
    2021-01-18 21:54

    In general, to use with JavaScript, you should use |escapejs filter:

    var $d = $('{{ value|escapejs }}');

    However, as a matter of best practice you'd better put {{ form|bootstrap }} in HTML, and use JavaScript just to fade in:

    
    
    

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