Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 16th, 2012  |  syntax: None  |  size: 0.84 KB  |  hits: 26  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How do I apply jquery-ui to a Backbone.js view?
  2. var ButtonView = Backbone.View.extend({
  3.     el: $('#ButtonId'),
  4.     initialize: function () {
  5.         $(this.el.selector).button();
  6.     }
  7. });
  8.        
  9. var ButtonView = Backbone.View.extend({
  10.     initialize: function () {
  11.         this.el.button();
  12.     }
  13. });
  14.  
  15. $(function(){
  16.     var myButton = new ButtonView({ el: $('#ButtonId') });
  17. });
  18.        
  19. var ButtonView = Backbone.View.extend({
  20.     el: '#ButtonId'
  21.     initialize: function () {
  22.         $(this.el).button();
  23.     }
  24. });
  25.  
  26. $(function(){
  27.     var myButton = new ButtonView({ });
  28. });
  29.        
  30. var ButtonView = Backbone.View.extend({
  31.  
  32.     initialize: function () {
  33.         _.bindAll(this, "render");
  34.     },
  35.  
  36.     render: function () {
  37.         this.el.button();
  38.         return this;
  39.     }
  40. });
  41.  
  42. $(function(){
  43.     var myButton = new ButtonView({ el: $('#ButtonId') }).render();
  44. });