I have a textbox which accepts user defined key value pairs like: {'Apple':'Red', 'Lemon':'Green'} and i want it to be converted to an array of key value pair. I have code:
var color= document.getElementById('txtColor').value;
The problem is i get it just as a string if i try: color['Apple']
it shows undefined; whereas i expect 'Red'. How can i do the conversion so that i get something like:
var color={'Apple':'Red', 'Lemon':'Green'}
and get value 'Red' on color['Apple']
.
Thanks in advance.