I am currently working on a simple code that aims to set a background color to a div when the page loads. Here is the code I have developed:
<div id="offerOne">
<img src="images/images.jpg" class="img-responsive center-block" alt="img">
</div>
Javascript:
<script type="text/javascript">
$('#offerOne').attr('style', 'background-color: #f12 !important');
</script>
Unfortunately, the background-color is not being applied to the div when the page loads. How can I resolve this issue?