Multi-line string insert using jQuery

前端 未结 4 1145
没有蜡笔的小新
没有蜡笔的小新 2020-11-27 18:47
$(\"#addSelect\").click(function() {
        $(\"#optionsForm\").after(\"Hello world.\");
} );

This works.

$(\"#addSelect\").click(         


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 19:35

    I prefer to use something like this:

    $(''
        + inputNotes.val() + ' ' + todayStamp
        + ' ')
    

    I feel like it's clean the + concatenation allows you to know we're working with the same black and it gives you the flexibility of adding variables.

提交回复
热议问题