Why can't I add a
with JQuery .html?

前端 未结 4 842
一个人的身影
一个人的身影 2021-01-04 07:32

Why does this code work:

$(\'div.error_container\').html(\'
No more foo allowed
\');

But this code cau

4条回答
  •  生来不讨喜
    2021-01-04 07:36

    Try breaking it up into a chain:

    var $div = $('
    ').html('No more foo allowed') .append('
    '); $('div.error_container').html($div);

提交回复
热议问题