开发者

Change background of li element with jQuery

I have a li element like this:

    <li class="file file-success">
    </li>

I want to change its backgrou开发者_Go百科nd using jQuery.

Note that I can't change the li element itself.


Do you want to change li text color or bullet color? The former can be achieved through this code:

$('li.file').css('background-color', 'yellow'});   

If you want to change bullet image, here is the code:

$('li.file').css('list-style-image', 'url(yourimage.jpg)'});   


You could use:

$("li.file").css("background-color", "#ff0000");

or

$("li.file-success").css("background-color", "#ff0000");

depending on what CSS selector you want to use for this.


$("li.file").css("background-image", "url(test.png)");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜