Input text that triggers a switch

Input text that triggers a switch


I'm writing a html site, and i'm trying to add a jquery input system.

I wrote a  html page were i divided every word into a class; an class= "A" and a class="B".
every class also has a another class attached to it; class="A key1" and a class="B key2".
i added a css stylesheet already for the A and B classes.

What i want is this: If got a text where every word has a "A key1" and "B key2" class. Default i want the "key1" class to be display:none;.
On the top of the page, i want a input box, where you can enter a word (any word). If the word, that has been put in by the user, equals the same as  "key2", then i would like it to switch between hiding "key1" and "key2". [So upon input, the key 1 is hiding and key 2 isn't. When the user inserts an word that equals that specific class, it would hide key 2 instead and display key1.]

Now, i'm trying to figure out how to do this. I found jquery tutorials on switching 2 things, and input data, but i can't combine the two.

Could someone help me please? THANKS!