Home > Web Front-end > JS Tutorial > body text

How to delete css style in jquery

青灯夜游
Release: 2023-01-05 16:08:03
Original
10129 people have browsed it

Jquery method to delete css styles: 1. Use removeattr() to remove all styles, the syntax format is "removeattr("style")"; 2. Use css() to remove a single style, the syntax format is "css ("Attributes","")".

How to delete css style in jquery

The operating environment of this tutorial: windows7 system, jquery1.10.0 version, Dell G3 computer.

jquery delete css style

1. To remove all styles, use removeattr("style");

2. To remove a single style use css("property","");

For example:

 <script type="text/javascript">
    	$(function(){
			$("li").mouseover(function(){
				//添加css样式
				$(this).css("background","#ffdd00");
			});
			$("li").mouseout(function(){
				//移出css样式
				$(this).css("background","");
			});
			    	
    	});
    </script>
Copy after login

Recommended related tutorials:jQuery tutorial

The above is the detailed content of How to delete css style in jquery. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template