问题
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