<tutorialjinni.com/>

jQuery Set Background Image

Posted Under: jQuery, Snippets on Feb 14, 2021
Code snippet to set background image, repetition of image and positions in any div or any HTML element using jQuery.
$("#my_elm_id").css('background', "url('COMPLETE_PATH_TO_IMAGE')");
$("#my_elm_id").css('background-position', "center center");
$("#my_elm_id").css('background-repeat', "no-repeat");
See also jQuery Remove Background Image


imgae