Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <link href="//cdn.jsdelivr.net/picnicss/4.1.1/picnic.min.css" rel="stylesheet">
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <h1>Hello Mag.JS!</h1>
  <a target="_top" href="https://github.com/magnumjs/mag.js">GitHub</a>
  <hr/>
  <div id="demo">
    <h2>Boilerplate</h2>
    <select id="menu">
      <option></option>
    </select>
    <input name="other" />
    <button>Submit</button>
    <result></result>
  </div>
  <script src="//rawgit.com/magnumjs/mag.js/master/mag-latest.min.js"></script>
  <script src="//rawgit.com/magnumjs/mag.js/master/dist/mag.addons.0.22.min.js"></script>
</body>
</html>
 
.hide {
  display: none;
}
input[disabled] {
  background: grey;
}
a {
  display: block;
}
a:after {
  content: " \bb";
}
 
var demo = {}
demo.controller = function(props) {
  this.show = mag.prop(false);
  this.other = 'HI'
  this.menu = {
    option: ['one', 'two', 'three']
  }
  this.select = 'three';
  this.input = mag.disable(this.show)
}
demo.view = function(state, props) {
  state.button = {
    _onclick: function() {
      state.show(!state.show());
      state.result = state.select + state.other;
    }
  }
}
mag.module("demo", demo)
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers