jQuery + client-side template = “Syntax error, unrecognized expression”

后端 未结 6 1044
离开以前
离开以前 2020-12-04 19:09

I just updated jQuery from 1.8.3 to 1.9, and it started crashing all of a sudden.

This is my template:



        
6条回答
  •  没有蜡笔的小新
    2020-12-04 19:33

    I guess your template is starting with a space or a tab.

    You can use jQuery like that:

    $($.parseHtml(modal_template_html)[1]);
    

    or parse the string to remove spaces of the beginning:

    $(modal_template_html.replace(/^[ \t]+/gm, ''));
    

提交回复
热议问题