Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>CanJS</title>
</head>
<body>
<script id="app-template" type="text/stache">
<input type="text" {{placeFocus}} />
</script>
<script src="https://unpkg.com/can/dist/global/can.all.js"></script>
</body>
</html>
 
can.stache.registerHelper('placeFocus',function(options){
    setTimeout(function() {
      var inputElement = options.nodeList[0];// Could be document.querySelector('input') or use jQuery
      inputElement.focus();
    }, 10);
});
// Root app template & view model
var appViewModel = new can.DefineMap({});
var renderApp = can.stache.from('app-template');
// Append the app template to the body
document.body.appendChild(
  renderApp(appViewModel)
);
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers