Jade: load external javascript and call function

后端 未结 3 1871
再見小時候
再見小時候 2021-01-02 09:33

I was learning Express/Node/Jade and now in the Jade file I want to include a javascript file from the public folder just for the page. For example, in jade file I type this

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-02 10:11

    Save your JS file and link it in your Jade file as:

    script(src="filepath/yourJSfile.js")
    

    Then call the function, I'm using a button here for example:

    button(class="btn", onclick='functionName()')
    

提交回复
热议问题