Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="CanJS jQuery">
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <hr>
  Tag Test (not working)
  <script id="date-template" type="text/stache">
    <date-picker>
      Here a date picker should appear
      <input type="text" {($value)}="a.date" id="test1"/>
    </date-picker><br>
  <hr>
  Attr Test (working)
    <p>Date: <input datepicker="abc" type="text" id="datepicker" {($value)}="a.date"></p>
    The date stored in the object a: {{a.date]}}
    <button ($click)="a.debug()">log(a.date)</button>
  </script>
 
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.js"></script>
<script src="https://unpkg.com/can/dist/global/can.all.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</body>
</html>
 
can.view.callbacks.tag("date-picker", function(el, tagData){
  console.log("tag test");
  $('#test1').datepicker();
  $(el).html('<input id="test2"/>');
  $('#test2').datepicker();
  /*var frag = tagData.subtemplate({
     first: "Justin"
   }, tagData.options);
   $(el).html( frag );*/
});
can.view.callbacks.attr("datepicker", function(el, attrData){
  console.log("attr test");
  $(el).datepicker();
});
var a=can.DefineMap.extend({
  name: "string",
  date: {type: "string", value: "111"},
  debug: function() {console.log(this.date);}
});
var mya = new a();
var template = can.stache.from('date-template');
document.body.append(template({a: mya}));
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers