Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://static.staticwars.com/mithril/0.1.26/mithril.js"></script>
  <meta charset="utf-8">
  <title>Mithril bug</title>
</head>
<body>
</body>
</html>
 
var model = {
  val : ""
};
//initialize
m.module(document.body, {
  controller : function() {
    this.clickEmpty = function(e) {
      e.preventDefault();
      
      model.val = "";
    };
    
    this.clickZero = function(e) {
      e.preventDefault();
      
      model.val = 0;
    };
    
    this.clickValue = function(e) {
      e.preventDefault();
      
      model.val = 125;
    };
  },
  
  view : function(ctrl) {
    return [ 
      m("input", { value : model.val }),
      m("button", { onclick : ctrl.clickEmpty }, "empty"),
      m("button", { onclick : ctrl.clickZero }, "zero"),
      m("button", { onclick : ctrl.clickValue }, "value")
    ];
  }
});
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers