Raj
Raj

Reputation: 21

I want to hide div after render call complete in backbone js

I want to hide div based on userId is null or not, I am getting userId from function. After loading html I want to hide one div based on condition.

render: function() {
    userId = kf.helper.getUserId();
    this.$el.html(this.template({}));
    return this;
  }

Here I am getting UserId

Upvotes: 1

Views: 32

Answers (1)

Divya Keswani
Divya Keswani

Reputation: 11

You are getting userId, check if it is null and send a parameter with template calling. param send boolean. Then in your template do conditional rendering. If param is true then simply hide or show div whatever you want.

Upvotes: 0

Related Questions