I have a text object (txt_fact) displaying a sentence that includes one word replaced with a line of blanks. I want the user to be able to replace the blanks with the missing word, or at least write on top of the blanks.
Currently I use the following method:
1. Add a second text object (txt_answer) that sits over the blanks in txt_fact.
2. Add a textbox object with the CSS set to render it invisible.
3. Focus the textbox and set txt_answer to display whatever text is typed into the textbox.
This would work fine, except fonts in a text object display differently depending upon the browser/device, so I can't guarantee that the position of txt_answer will always lie precisely over the blanks.
Is it possible to derive the coordinates of characters in a string? e.g. find x,y for the 3rd "_" in "I laughed at the _______ dog."
Failing that, is this something I can handle with regex? I figured I might be able to use a replace expression, but I'm unsure how to handle the user deleting characters that have been added once the blanks have been replaced.
Or maybe there is another way?