title: backbone.js view id tag using information from model
body: <p>I am using backbone.js,</p>
  
  <p>I have a model that is formatted like this:</p>
  
  <pre><code>{
    username:"name",
    id:"1",
    picture:"image.jpg"
  }
  </code></pre>
  
  <p>I want to have a view like this:</p>
  
  <pre><code>&lt;div id="1"&gt;
      &lt;span class="name"&gt;name&lt;span&gt;
      &lt;img src="image.jpg" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>from this template:</p>
  
  <pre><code>&lt;script type="text/template" id="users-template"&gt;
      &lt;span class="name"&gt;&lt;%= username %&gt;&lt;/span&gt;
      &lt;img src="&lt;%= image %&gt;" /&gt;      
  &lt;/script&gt;
  </code></pre>
  
  <p>but I get stuck when it comes to putting the users id into the views id attribute.</p>
  
  <pre><code>UserView = Backbone.View.extend({
  
      id: this.model.id, //this is what I have tried but it doesnt work
  
      initialize: function(){
          this.template = _.template($('#users-template').html());
      },
  
      render: function(){
          ...
      }
  })
  </code></pre>
  
  <p>does anyone know how put the current models id into the id attribute?</p>