As I add and remove a class by making click on a row


hello as I add and remove a class by making click on a row.{

‘click .room-tbody tr’: function(event){
‘click .selected’: function(event){
console.log(“se quita”);


It’s very hard to figure out what you’re trying to say. Can you try to rephrase the question?


sure, what I try to do is that when you click in a row a class is added to td, but if I click again the class is removed.

thanks for your help and forgive the language


hello, solve it so

‘click .room-tbody tr td’: function(event){
if ($(“reserved”)) {
console.log(“esta esta registrada”);
} else if($(“selected”)) {
} else {$(‘selected’); }


Ok, glad you figured it out!


I dont think you need the event.preventDefault(); because you’re just working on a click event on a table cell.
You only need prevent default when there is some default browser behaviour you want to prevent, like on a form submission or a anchor/URL click…