im starting to use Backbone.js and im trying to do somthing simple with javascript, which is show/hide divs. I get to show the div but i cannot hide it, i try many things, any idea? or could be it more sophisticated?
var Step1View = Backbone.View.extend({
el: $('body'),
events: {
'click #more': 'more',
'click #hide': 'hide',
},
initialize: function (){
_.bindAll(this, 'render', 'more', 'next', 'less');
this.render();
},
render: function (){
var self = this;
$(this.el).append("<a id='more'>Show more</a>");
$(this.el).append("<div id='show' style='display: none'>Div12</div>");
return this;
},
more: function (){
$('#more').text('Hide more');
$('#more').attr('id', '#hide');
$('#show').show();
},
less: function (){
$('#hide').text('Show more');
$('#show').hide();
},
});
Cheers