i am dynamically adding content using ajax after added the content i am trying to change background image using jquery it's not working this is my code.
Ajax code:
function loadlogin(url, loginFunction)
{
var xhttp;
xhttp=new XMLHttpRequest();
xhttp.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
loginFunction(this);
}
};
xhttp.open("GET", url, true);
xhttp.send();
}
And this is my jquery code :
<div class="img-fluid" src="img.png">
<script>
$(document).on( "click", ".img-fluid", function(event) {
var background = $(this).attr("src");
$(".fullpage_wrapper").css("background","url(" + background + ")");
});
</script>
please help me to solve this problem.