I'm trying to replace an image in body background using jQuery, but no matter what I do, it doesn't work. Code is almost the same as in other questions or tutorials. Here's CSS which works:
body{
background-image: url('img/1.jpg');
}
But here's jQuery which doesn't:
$('body').css('background-image', 'url(img/2.jpg)');
and HTML:
<html lang="pl">
<head>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js">
</script>
<script src="script.js"></script>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
<Title> Moja firma </Title>
</head>
<body>
</body>
</html>
I checked, and jQuery is loaded as well as the file with its code. I also tried putting quotes in url, but also nothing.