characters count using js

I am unable to count the characters in an input tag . I want something like when the user will enter a key it should show me the updated value after each key enter.But first time when i type nothing happens and when i click on sumbit and than again enter key than it works . here is my website link"https://talhamustafa1.github.io/Phishing-Training-Website/learn.html" at the end of this webpage there will be accordian which when clicked will show a input tag with sumbit button
No description
6 Replies
dys 🐙
dys 🐙12mo ago
How about pasting in the code in a \\``js` (I'm trying to make a triple backtick 😹) block?
Jochem
Jochem12mo ago
there's instructions for code blocks in #how-to-ask-good-questions
Moni
MoniOP12mo ago
i am unable to send complete code
Jochem
Jochem12mo ago
I can't currently go digging around your complete site to debug this. My first cursory glance seemed to show that you don't have a change or keydown event handler bound? that's why a lot of places (us included) recommend asking questions with a minimum viable example. Just an input field with the event handler in this case it's not required, but it'll help people help you
MarkBoots
MarkBoots12mo ago
it is because you initialize the input eventlistener inside the answerCheck() function. that function is called on the button click event so before that submitbutton click, the eventlistener does not exist yet
Moni
MoniOP12mo ago
Thanks i will take care of it next time
Want results from more Discord servers?
Add your server