Home>Article>Web Front-end> How to remove the background of div with jquery

How to remove the background of div with jquery

青灯夜游
青灯夜游 Original
2022-05-24 14:58:34 1994browse

Two methods: 1. Use css() to set the background attribute, the syntax is "$("div").css('background','none')"; 2. Use attr() to add a new background Style, syntax "$("div").attr('style','background:none')".

How to remove the background of div with jquery

The operating environment of this tutorial: windows7 system, jquery3.2.1 version, Dell G3 computer.

Two ways to remove div background with jquery:

##Method 1. Use css()

Use css() to set the background attribute of the div element, the value is none

       
hello

How to remove the background of div with jquery

##2. Use attr()


Use attr() to set the style attribute for the div element and add the background:noney style.

       
hello

How to remove the background of div with jquery【Recommended learning:

jQuery video tutorial

,web front-end video

The above is the detailed content of How to remove the background of div with jquery. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn