I'm trying to add a class to elements clicked on. The elements have several clases already assigned to them including one with a border.
Although I know I can remove a current CSS class using removeClass() I need other styles that the class provides. So what I wonder is given the following examples can I not override a border style with addClass() is that border has a property already set? I don't want to use inline styles as they are not as easy to maintain.
CSS:
.dibHighlight{border:1px solid orange;}
JQuery that doesn't work:
$(this).closest('.drop').addClass('dibHighlight'); // Doesn't work
JQuery that works:
$(this).closest('.drop').css({ border: "1px solid orange" }); // Works
.dibHighlight
rule. – Judas