jquery上的html代码的下一行

时间:2014-10-20 10:48:27

标签: javascript jquery coffeescript

我在这里是我的jquery(coffeescript)

    if value.kind != 'Quasi-Judicial'
      if value.court_agency !in court_agency_with_branch
        if value.court_agency != 'Department of Justice'
          @court_agency  = "<option value=\"" + value.id + "\"> Branch "+ value.branch_division + ", " + value.court_agency + ", " + @city_or_municipality + ", " + value.province + "</option>"              
        else
          @court_agency  = "<option value=\"" + value.id + "\">" + value.court_agency + ", " + @city_or_municipality + ", " + value.province + "</option>"
      else
          @court_agency  = "<option value=\"" + value.id + "\"> Division "+ value.branch_division + ", " + value.court_agency + "</option>"              
    else
      @court_agency  = "<option value=\"" + value.id + "\">" + value.department + ", " + value.govt_agency + ", " + @city_or_municipality + ", " + value.province + "</option>"      

就此而言

"<option value=\"" + value.id + "\">" + value.department + ", " + value.govt_agency + ", " + @city_or_municipality + ", " + value.province + "</option>"              

我想放一些代码\n

"<option value=\"" + value.id + "\">" + value.department + ", " + "\n" + value.govt_agency + ", " + @city_or_municipality + ", " + value.province + "</option>" 

但没有任何反应。

该值如下所示:

Department of Blah blah, City of This thing, Province of this stuff

我可以使用哪些代码来创建这样的输出:

Department of Blah blah,
City of This thing,
Province of this stuff

2 个答案:

答案 0 :(得分:0)

看看Can you have multiple lines in an <option> element?。 (你要找的是选项标签中的br标签)

答案 1 :(得分:0)

请参阅此演示 http://shyalika.com/mutiline_select_example

您可以在此处找到更多信息: http://shyalika.com/multiline_select_control