Jquery 无法在 PUG 中工作。即使我包含 jQuery 也无法识别 $ 符号
Jquery not working inside PUG. Isn't recognising $ sign even though I have included jQuery
我已将我的 jquery 代码放入 pug 模板中,但它不是 运行ning。我正在尝试 运行 jQuery 函数,但我收到以下错误,即使我也包含了 jQuery 文件:-
40| P
41| script(type="text/javascript")
> 42| - $("#image-drop-area").dropzone({ url: "/file/post" })
$ is not a function
这是我的哈巴狗模板:-
p
label(for="tags") Tags (Seperated by comma):
input(type="text" name="tags" id="tags" required autofocus)
P
script(type="text/javascript")
- $("#image-drop-area").dropzone({ url: "/file/post" })
错误是处理 pug 文件中的 javascript/jquery 行(带有 -
)。试试这个:
script(type="text/javascript").
$("#image-drop-area").dropzone({ url: "/file/post" })
注意末尾的点:script(type="text/javascript").
。它将以下块作为纯文本写入 script
标记。
我已将我的 jquery 代码放入 pug 模板中,但它不是 运行ning。我正在尝试 运行 jQuery 函数,但我收到以下错误,即使我也包含了 jQuery 文件:-
40| P
41| script(type="text/javascript")
> 42| - $("#image-drop-area").dropzone({ url: "/file/post" })
$ is not a function
这是我的哈巴狗模板:-
p
label(for="tags") Tags (Seperated by comma):
input(type="text" name="tags" id="tags" required autofocus)
P
script(type="text/javascript")
- $("#image-drop-area").dropzone({ url: "/file/post" })
错误是处理 pug 文件中的 javascript/jquery 行(带有 -
)。试试这个:
script(type="text/javascript").
$("#image-drop-area").dropzone({ url: "/file/post" })
注意末尾的点:script(type="text/javascript").
。它将以下块作为纯文本写入 script
标记。