Skip to content

Instantly share code, notes, and snippets.

@bagobor
Created March 28, 2013 10:26
Show Gist options
  • Save bagobor/5262212 to your computer and use it in GitHub Desktop.
Save bagobor/5262212 to your computer and use it in GitHub Desktop.
<html>
<head>
<script src='/js/libs/jquery-1.7.2.min.js'></script>
<script src='/js/libs/underscore.js'></script>
<script src='/js/libs/backbone.js'></script>
</head>
<body>
<div class='test'>Test</div>
<button class='btn'>Update</button>
<script>
var p = {
projects : {
el : ['list', 'tasks']
}
};
var data = {};
$(document).ready(function(){
var DocumentRow = Backbone.View.extend({
el: '.test',
initialize: function() {
this.$el.data('view', this);
},
render: function() {
this.$el.html( "Update from View" );
}
});
var view = new DocumentRow();
$('.btn').click(function() {
$('.test').data('view').render();
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment