I have this piece of code which calls the charCounter() function anytime user enters any letter in the input. Its working properly:
Now I am trying to mimc the above code, sending the title and left objects instead:
I have defined the following objects:
I think 'a' and 'b' are correct objects b/c a.value and b.value are the correct values, so I send the 'a' and 'b' objects to charCounter() function and expect the charCounter() function gets called anytime user
enters any letter in the Title or Left fields. Following is how I tried to attach the even listeners to the objects, also call the function.
How can I fix this?
Joined: Nov 01, 2011
Some correction to the code! I modified the code as following; when the script executes for the first time, it gets inside charCounter() function and does calculate the remaining chars correctly, b/c I get:
TITLE: Auto Body and Paint
16 characters left
But then it does not do anything else as I type in Title field. So can you help me fix this in a way that does NOT go inside charCounter() when the script executes for the first time and instead gets in that function when user enters anything in the field?