jquery change css background image

There is two ways of achieve the css set background image using jquery.
First:

$('.classname').css({'background':'url(images/tabs3.png)'});

Second:

$('.classname').css('background', 'url(images/tabs3.png)');

The first method can set multiple css at one time. While the second method only one css per time.

By Keenlio, May 20, 2014

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *


2 × = twelve

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>