How to create HTML select option from JSON hash?

后端 未结 3 944
孤独总比滥情好
孤独总比滥情好 2020-12-09 07:13

I have a simple JSON code:

[{\'1\':\'Name\'}, {\'2\', \'Age\'}, {\'3\',\'Gender\'}]

I have a select tag in my HTML:



        
3条回答
  •  温柔的废话
    2020-12-09 07:35

    Just for kicks here is an answer in pure javascript, also you probably do not need an array for this just a simple object will suffice

        
        
    

提交回复
热议问题