onKeyPress callback location value staying at 0

Example: App Lab - Code.org
What I expect to happen: the location value to contain the location in the text_area string where the edit is/where the new character got added.
What actually happens: Stays at a constant 0

Hi @justinolsen2007,

JSON is beyond the scope of both CSD and CSP. Perhaps one of our more advanced users can help you out?

~Michelle

I don’t think that location works for keydown or keypress. It might be good to know what you want to make with it, because if the user isn’t writing that much text, you could probably just have a for loop that looks for changes in the code, and writes down the position of said change. If they will have to write a lot of text, I’m not sure how well that would work.

i will just add the for loop to find the change location idea, thanks. What I’m trying to do is have it so that if the user types a specific character add a pre-defined set of characters where the user typed.