Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6354017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:30:33+00:00 2026-05-24T22:30:33+00:00

my backbone view looks like this below and is rendered with the jQuery tmpl

  • 0

my backbone view looks like this below and is rendered with the jQuery tmpl library. I want to apply a style to one/all/any of the data items for which
active==1. Any ideas on how to do this?

   // backbone view 
   window.CaseView = Backbone.View.extend({

    el: $("#main"),

    initialize: function() {
        _.bindAll(this, 'render');
        this.render();
    },

    iTemplate: $("#tmplCase").template(),

    render: function() {
        var that = this;
        that.el.fadeOut('fast', function() {
            $.tmpl(that.iTemplate, that.model.toJSON()).appendTo(that.el);
            that.el.fadeIn('fast');
        });

        return this;
    }
});

// html file
<div id="main"></div>

<script id="tmplCase" type="text/x-jquery-tmpl">
  <div class="caseInActive">
    <span class="title">${title}</span>
    <span class="current_status">${active}</span>
  </div>
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:30:33+00:00Added an answer on May 24, 2026 at 10:30 pm

    you can add if statements to your template:

    // html file
    
    <script id="tmplCase" type="text/x-jquery-tmpl">
    
    
      <div {{if active == 1}}class="caseInActive"{{/if}}>
    
    
        <span class="title">${title}</span>
        <span class="current_status">${active}</span>
      </div>
    </script>
    

    http://api.jquery.com/template-tag-if/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a standard list view setup with backbone that looks something like below.
I have a view and collection like this: window.DmnView = Backbone.View.extend({ template: _.template($(#tmpl_dmnListItem).html()), events:
I have a backbone app with a view structure that looks like the following
Take a look at this jsFiddle Code also listed below: window.MyView = Backbone.View.extend({ ticks:
I'm beginning with backbone.js Going through some tutorials, like the one shown below. I
I have a working coffeescript/backbone idiom that looks like this: SidebarWidgets = ((() ->
So I have a View that looks like this. //base class var SelectListView =
I have a simple Backbone view which uses jQuery UI's buttons. For example I
My class is defined as below: class NewUser extends Backbone.View template : JST[backbone/templates/events/new] events
I have two backbone Views. One is the main view and the other is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.