select Tests

by bryan_weaver

HTML

<select id="mapTypeSelect"></select>
<button id="btnCButton">Launch Map</button>

CSS

select {
    margin-right: 10px;
    width: 125px;
}

JavaScript

var select = $('#mapTypeSelect');
 select.append($('<option>', {
     value: 100000000,
     text: 'Google',
         "data-mapid": "google map id"
 }));
 select.append($('<option>', {
     value: 100000001,
     text: 'ESRI',
         "data-mapid": "esri map id"
 }));
 select.append($('<option>', {
     value: 100000002,
     text: 'External',
         "data-mapid": "external map id"
 }));


 var btn = $('#btnCButton')
     .click(function () {
     alert($('#mapTypeSelect option:selected').val());
     console.log($('#mapTypeSelect option:selected').data().mapid);
 });