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
6 Replies
How about pasting in the code in a
\\
``js` (I'm trying to make a triple backtick 😹) block?there's instructions for code blocks in #how-to-ask-good-questions
i am unable to send complete code
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
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
Thanks
i will take care of it next time