'My Node js app add Javacript script file not working click
My pug file
doctype html
html(lang="en")
head
meta(charset="UTF-8")
meta(http-equiv="X-UA-Compatible", content="IE=edge")
meta(name="viewport", content="width=device-width, initial-scale=1.0")
link(rel="icon", href="../public/images/chat.png" , type="image/x-icon")
link(rel="stylesheet", href="../public/css/reset.css")
link(rel="stylesheet", href="../public/css/chat.css")
script(src="../utils/script.js" , type='text/javascript')
title #{header}
body
div(class="chat_container")
block left
block chat_menu
block chat_user_info
chat_menu pug layouts
div(class="chat_write_box")
div(class="chat_write_message")
form(action="#", method="post")
input(id="chat_write_message_input" ,type="text" , placeholder="Send Message")
button(type="submit")
img(src="../public/images/send.png", alt="send.png")
span(class="chat_microphone")
img(src="../public/images/micro.png", alt="micro.png")
span(class="chat_smile")
img(src="../public/images/smile.png", alt="smile.png",class="chat_smile_icon")
span(class="chat_attach")
img(src="../public/images/attach.png", alt="attach.png")
My script.js file
const smileBtn = document.querySelector('.chat_smile_icon');
smileBtn.addEventListener('click',function(){
alert('clicked');
})
This my node.js project I am using pug template and add script.js file using javascript code blocks but javascript click not working Please help me Thanks !!!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
