<span id="icon"></span>
#icon::before {
content: url("../image/search-1.svg");
}
$('#icon').css({"content":"url(\"../image/search-2.svg\")"});
<span id="icon-1"></span>
<span id="icon-2"></span>
#icon-1 {
opacity: 1.0;
}
#icon-2 {
opacity: 0.0;
}
#icon-1::before {
content: url("../image/search-dark.svg");
}
#icon-2::before {
content: url("../image/search-light.svg");
}
$('#icon-1').animate({'opacity':'0.0'},400);
$('#icon-2').animate({'opacity':'1.0'},400);
$('#icon:before').css({
'content': "url('../image/search-2.svg')";
});
<span id='icon' data-src='../image.png'></span>
#icon { content: url(data-src); /* ... */ }
$('#icon').data('../baz.png');
$('style').text('#icon:before { content: url(baz.png); }').appendTo('body')