Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Mithril select dropdown with placeholder alternative">
  <meta charset="utf-8">
  <title>JS Bin</title>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/mithril/0.2.0/mithril.min.js"></script>
</head>
<body>
</body>
</html>
 
var app = {};
app.controller = function(opts) {
  this.opts = ["Chrome", "Safari", "Firefox"];
};
app.view = function(ctrl, opts) {
    return m('select', [
    m('option', {
        value: '',
        selected: 'selected',
        disabled: 'disabled'
    }, 'Select your option'),
    ctrl.opts.map(function(opt) {
        return m('option', {
            val: opt
        }, opt.charAt(0).toUpperCase()+opt.slice(1));
    })
]);
};
m.mount(document.body, app);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
ArthurClemenspro
0viewers