JSFiddle - React, Tailwind, and code Playground

by nachiket

HTML

<select id='selectElm'>
    <option value=1>ONE</option>
        <option value=2>TWO</option>
</select>
<div id='result'></div>

JavaScript

$('selectElm').addEvent('change', function(e) {
    console.log(e);
    console.log('Change Event fired on SelectElm');
});

var baySelector=new Element("select",
                {
                    name:"idBay",
                    id:"baySelector",
                    styles:{
                        width:'100px'
                    },
                    events:{
                        change:function(e){
                            var idBay = e.target.value;
                            console.log(e);
                        }
                    }
                });

Array.each(['a','b','c','d'],function(bay){
            baySelector.adopt(new Element('option',{
                        value:bay,
                        text:bay
                    })
                );
            });

$(document.body).adopt(baySelector);