Adding line breaks to a jquery string parameter

This question already has an answer here:

  • Creating multiline strings in JavaScript 34 answers

  • So I found the solution! After further digging I found the function call that creates the 'description' parameter, which was basically:

    this.$description = $( '<p></p>' ); 
    

    By simply adding a

    <br /> 
    

    into the full string itself I was able to create the line breaks successfully. I think initially it was not working because I was doing it like:

    'Production Plant: Summit' + '<br />' + 'Color Cassification: Heritage Series',
    

    when all it really needed was:

     'Production Plant: Summit <br /> Color Cassification: Heritage Series'.
    

    Hope this helps out someone else in the future. Thanks for the responses.

    链接地址: http://www.djcxy.com/p/30446.html

    上一篇: 将一个字符串块复制并粘贴到JS代码中

    下一篇: 将换行符添加到jquery字符串参数