user2286483
user2286483

Reputation: 179

backbone.js escaping html

im pulling html from my database to display on my page using backbone.js

the data is stored like this

<p> TEST</p> <p>TEST 1</p> <p>TEST 2</p>

in my page when using underscore.js

pp<%= title %>

<%= mainContent %>

    </div>            </div>      </script>

  <!-- sample template for pagination UI -->      <script

type="text/html" id="tmpServerPagination">

              <% if (currentPage < totalPages) { %>
                  <a href="#" class="btn long servernext">Show More</a>
              <% } %>

        </div>
    </script>

it renders

TEST

TEST 1

TEST 2

Where i want it to read the tags and apply the formating to the page

TEST TEST 1 TEST 2

this is my view

( function ( views ){

views.ResultView = Backbone.View.extend({ tagName: 'li', template: _.template($('#resultItemTemplate').html()), initialize: function() { this.model.bind('change', this.render, this); this.model.bind('destroy', this.remove, this); },

  render : function () {
      this.$el.html(this.template(this.model.toJSON()));          return this;
  }   });

})(app.views);

Upvotes: 0

Views: 257

Answers (1)

foiseworth
foiseworth

Reputation: 991

If you're just trying to display the paragraphs inline, then you could use:

p { display: inline-block; }

You'll probably want to namespace this (e.g. .pagination p) so that it doesn't affect all the paragraphs on the page.

Upvotes: 0

Related Questions