views:

644

answers:

2

I have a html select input with a default set of options (it has an ID). I also have a json object that looks like

var replacement_options = {'value 1':'display 1', 'value 2':'display 2' ....

How would I replace the options in the select with the values and displays from the json object using Facebook JS? (FBJS)

+1  A: 

try playing with the FBJS function selectNode.removeChild described in the FBJS wiki entry FBJS

you will also need to use

var option = document.createElement('option');
selectNode.appendChild(option);

to create the option nodes inside the select node

Janek
+2  A: 
RobKohr