LoginSignup
0
0

【PUG】inputにネストしたら怒られた

Posted at

はじめに

PUGでlabelとinputを使ってチェックボックスを作っている時につまづいたので備忘録

事象

<label>
    <input type="checkbox" name="hoge" value="0">チェック
</label>

このHTMLをつくるためにPUGで下記のように記述した。

label
    input(type="checkbox")チェック

すると、下記のエラーが出た。

input is a self closing element: <input/> but contains nested content.

原因

input is a self closing element: <input/> but contains nested content.

このエラーはinputは自分だけで完結するのでネストはだめ!ということ。

対応方法

inputにネストされている「チェック」という文字列をinputと同列にする。

label
    input(type="checkbox") チェック
label
    input(type="checkbox")
    span チェック

これでエラーは解消された。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0