I add css property to a button with: $('#salvaImpegno').css("cursor", "not-allowed"); and it works.
But I can't remove it. I tried with: $('#salvaImpegno').removeProp("cursor");, but it doesn't work.
Why?
Because css is not a property.
You have to remove the property style.
like this:
$('#salvaImpegno').removeProp("style");
or more correctly
$('#salvaImpegno').removeAttr("style");
because style is an attribute, more than a property of an element.
But it will remove all the styles you added through .css() method. If you want to only reset cursor property refer other answers.
instead you can try using .addClass(), so maybe you can do something like
$('#salvaImpegno').css("cursor", "not-allowed");
and then when you want to remove the "cursor" you can add a class that overrides the other like this.
/----CSS---/
.cursorOverride{
cursor: pointer !important;
}
/---js---jQuery----/
$('#salvaImpegno').addClass("cursorOverride");
If you want to be able to reomve the class you can do that with .removeClass(). I hope this helps!
.removeprop()undoes.prop(). it has nothing to do with css.