I am building a section on my website for language learning. The user will see the word でんき (Japanese word). When someone enters in the correct text that matches each symbol, one of them will light up. How could I achieve this?
Here is a preview image of my site: http://imageshack.us/photo/my-images/827/hiraganaquiz2.jpg/
Here’s a simple way:
Explanation:
The
data-valuewill hold the English text of your character. When the user types a value that matches it, it will add thehighlightclass to all elements that have adata-valuematching the text. Just apply your “lighting up” styles to the class.Demo: http://jsfiddle.net/MTVtM/
To work with multiple words just
splitthe value by a space and check each piece:Demo: http://jsfiddle.net/MTVtM/1/ (Try entering “Car Boat”)