SooIn Nam SooIn Nam - 1 month ago 12
jQuery Question

How to remove css property in JQuery

if(prev_clicked)
{
$("#accordion li a.category").css('background-image', 'url("img/off_all_channel.png")');
$("#accordion li a.comment").css('background-image', 'url("img/on_all_online.png")');
$(".icha0").removeProperty("background-color");
$(".icha0").removeProperty("opacity");
}
else
{
$(".icha0").css("background-color","#D5D5D2");
$(".icha0").css("opacity","0.70");
}


I am trying to remove two css properties that I added but It seems not working.
Any though?

Answer

You can remove them by:

$(".icha0").css({ 'background-color' : '', 'opacity' : '' });