[英]Pug (Jade) HTML form
我正在嘗試使用 Pug 創建以下簡單表單:
<body> <form action="/add_movie" method="POST"> <p> title: <input type="text" name="title" value=""/> year: <input type="text" name="year" value=""/> imdb: <input type="text" name="imdb" value=""/> </p> <input type="submit" value="Submit"/> </form> </body>
但是我不能讓表單只使用一個p
標簽。 這是我想出的:
body h1= "Add a movie!" form(action="/new_movie" method="POST") p Title: input(type="text" name="title" placeholder="") p Year: input(type="text" name="year" placeholder="") p imdb: input(type="text" name="imdb" placeholder="") input(type="submit")
有沒有辦法在一個p
標簽內在 Pug 中重新創建原始 HTML 表單?
我使用這個網站https://html2jade.org/從 HTML 傳遞到 Pug,它非常有用。
為您的 HTML 提供的解決方案是這樣的(與@Quentin 的答案相同)
html
head
body
form(action='/add_movie', method='POST')
p
| title:
input(name='title', value='', type='text')
| year:
input(name='year', value='', type='text')
| imdb:
input(name='imdb', value='', type='text')
input(value='Submit', type='submit')
body
form(action="/login" method="POST")
p Username:
input(type="text" name="username" placeholder="Enter Your Username ")
p Password:
input(type="password" name="password" placeholder="Enter Your Password ")
input(type="submit")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.