错误:输入为自动关闭,不应包含内容 [英] error: input is self closing and should not have content
问题描述
我试图拿起一些 Jade
与express一起使用,但是我很难理解为什么会出现此错误.我的整个.jade文件是:
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
我遇到了以上错误,以某种方式链接到了第13行的输入(当我删除它们时不会发生):a(href ='#'onclick ='getProfileLogin()')<返回
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
推荐答案
错误消息有些令人困惑,但是问题是您在(
.
The error message is a little confusing, but the issue is your whitespace before the (
.
input.loginInput (type='text', name='user')
应该是
input.loginInput(type='text', name='user')
这也适用于您的其他输入行.
This also applies to your other input lines.
由于有空格,您声明的是没有属性的< input>
和内容(type ='text',name ='user')
这不是大声一点,因为HTML规范将< input>
标记定义为 Empty
,这意味着它可以没有子节点.
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.
这篇关于错误:输入为自动关闭,不应包含内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!