I'm using backbone, jquery and handlebars on my project.
I'm trying to change row class just on click.
I mean if I click edit button (right of the table), it changes the class.
Look the table screenshot to understand.
AdminTableView.js
var addAdminPanelView = Backbone.View.extend({
el:$(".page"),
events:{
'click #editButton':'editEvent',
'click #deleteButton':'deleteEvent'
},
editEvent:function(){
console.log("edit");
this.$el.children().find("th").addClass("info");
},
My template
<tbody id="myTable">
<tr class="active">
{{#travels}}
<th>{{user.department.departmentName}}</th>
<th>{{user.managerID}}</th>
<th>{{user.firstName}} {{user.lastName}}</th>
<th>Seyahat Başlangıcı</th>
<th>Seyahat Sonu</th>
<th>{{location}}</th>
<th>{{travelPurpose}}</th>
<th>{{travelCost}}</th>
<th>{{projectCode}}</th>
<th> <a href="/#travel">
<span id="deleteButton" class="glyphicon glyphicon-minus-sign"></span>
</a>
<a href="#">
<span id="editButton" class="glyphicon glyphicon-edit"></span>
</a>
</th>
{{/travels}}
</tr>
</tbody>
If I click any edit button, all rows have added class "info"