title: How to get a data-id attribute with jQuery
body: <p>I'm trying to get department's id value. I mean I need to get the <code>departmentID</code> from the element.</p>
  
  <p>This function is getting the input value of elements having <code>departmentName</code> as a class. </p>
  
  <pre><code>this.$el.find(".departmentName").val()
  </code></pre>
  
  <p>example jSON</p>
  
  <pre><code>{
    "departmentID": 1,
    "departmentName": "BT"
  },
  </code></pre>
  
  <p>My code from a BackboneJS view callback</p>
  
  <pre><code>saveEvent:function(e){
    this.$el.find(".departmentName").val(); // getting "BT"
    this.$el.find(".departmentName").attr("departmentID");//this is not working
  
    this.render();
  },
  </code></pre>
  
  <p>template</p>
  
  <pre><code>&lt;th&gt;
      &lt;span&gt;{{user.department.departmentName}}&lt;/span&gt;
      &lt;input data-placement="top" 
             data-id="{{user.department.departmentID}}" 
             title="Boş geçilemez!" 
             class="form-control text-center departmentName" 
             type='text'
             style='display: none;' 
             value='{{user.department.departmentName}}'/&gt;
  &lt;/th&gt;
  </code></pre>