Set background-image using jQuery CSS property.
<!DOCTYPE
html>
<html>
<head>
<title></title>
<script
src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs="
crossorigin="anonymous"></script>
</head>
<body>
<button>add
bg image</button>
<script
type="text/javascript">
$("button").click(function(){
$("body").css("background","url('3559621.jpg')")
})
</script>
</body>
</html>
Post a Comment
If you have any doubts, Please let me know
Thanks!