Change an input when you change another one in javascript
===

Hard to define the title ^^ 

I want to have to input fields. For example: one where you type in a color and another for the code of the color. 

Like this: |Green| |#657EC9| (just random color-code) 

I do not want to learn how to find the color-code but how to match a value or variable with another. It was just an example. 

What i wanna know is how I in the best way auto generate one of the fields when I fill in the second. When I type 'green' in the first field I want the code to automatically appear in the second and vice versa. I just want to do it for a few colors. 

I am very new to PHP, HTML and Javascript and could need some good advice for how I should handle the problem. 

Thank you