First time here 🙂
I have a textarea and an input and I would like that, when something is typed into the texarea, it copies it to the input onkeypress. But the input must be limited to 10 characters. Then I would like to add 5 numbers to the end of the value of the input
EG:
Textarea content: “Hello world, how are you?”
Input content: “Hello worl12345”
I have tried this and this
but on the second one I think its really messed up code and requires some “cleaning”. Besides, it lacks the function of adding 5 numbers at the end.
You could use javascript to get the text area’s value example:
then you could use the substring function to cut the string off after 10 characters
then if you wanted to just add 12345 to the end.
and then use getElemendById of the input area to set it to the finished string.
You could put this all in a function and then call it on key pressed.