Reputation: 154
I'm trying to hide content of this td, according to ajax success status, is customer status equal to authorized content should be hide, how to do this?
'<td class="actions">\n' +
' <a ' + (customer.status == 'Authorized' ? 'disabled' : '') + ' class="btn-sm btn-default editBtn"\n' +
' data-target="#exampleModal"\n' +
' data-toggle="modal"\n' +
' data-cif=' + customer.cif + '' +
' data-status=' + customer.status + '>' +
' <i class="fas fa-pencil-alt">\n' +
' </i>Edit</a>\n' +
'</td>' +
Upvotes: 1
Views: 55
Reputation: 314
Instead of appending a disabled attribute you could append a class name when it's authorized, like this:
'<td class="actions">\n' +
' <a class="btn-sm btn-default editBtn '+ (customer.status == 'Authorized' ? 'hide' : '') +'"\n' +
' data-target="#exampleModal"\n' +
' data-toggle="modal"\n' +
' data-cif=' + customer.cif + '' +
' data-status=' + customer.status + '>' +
' <i class="fas fa-pencil-alt">\n' +
' </i>Edit</a>\n' +
'</td>' +
And then on your CSS side you can have this:
.hide{
display: none;
}
Upvotes: 1