Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script class="jsbin" src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.2.2/underscore-min.js"></script>
  <script class="jsbin" src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.5.3/backbone-min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
  article, aside, figure, footer, header, hgroup, 
  menu, nav, section { display: block; }
</style>
</head>
<body>
  <p id="hello">Hello World</p>
</body>
</html>
 
PB_SearchEntryView = Backbone.View.extend({
    template: _.template("<div id='searchEntry' class='searchEntry'><input id='part'></input><button id='findit'>Search</button></div>"),
    events: {
        "click button": "find",  
        "blur input": "close"
    },
    initialize: function(args) {
        this.dad = args.dad;
        var self = this;
        setTimeout(function() {
          self.render();
          alert('rerendered');
        }, 10000);
    },
    render: function(){
        $(this.el).html(this.template());
        return this;
    }
  },
  close: function(event){ alert("blur"); },
    find: function() {
        alert("Find!");
    }
});
$(function() { 
  var x = new PB_SearchEntryView({ el : $("#hello") });
  x.initialize({ dad : "Dad"});
x.render();
});
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers