error: input is self closing and should not have content

会有一股神秘感。 提交于 2020-01-05 08:24:31

问题


I'm trying to pick up some Jade to use with express, and I'm having trouble understanding why I'm getting this error. The whole of my .jade file is:

.login
#register
  div(style='float:right')
    p
      input.loginInput (type='text', name='user')
    p
      input.loginInput (type='password', name='pass')
    p
      input#button.loginInput (type='submit', value='Join')
  div(style='text-align:right;padding-right:110px;padding-top:3px;')
    p IGN:
    p Password:
  a(href='#' onclick='getProfileLogin()') < Back

I'm getting the above error, somehow linked to the inputs (it doesn't happen when I remove them) at line 13: a(href='#' onclick='getProfileLogin()') < Back


回答1:


The error message is a little confusing, but the issue is your whitespace before the (.

input.loginInput (type='text', name='user')

should be

input.loginInput(type='text', name='user')

This also applies to your other input lines.

By having the space, you are declaring an <input> with no attributes, and the content (type='text', name='user') which is not aloud because the HTML spec defined <input> tags as Empty, meaning then can have no child nodes.



来源:https://stackoverflow.com/questions/20811379/error-input-is-self-closing-and-should-not-have-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!