Measuring one hundred and four open road: jquery operating style

 

jquery operating style

 

Add styles, delete styles

 

Transition style

 

CSS ( "Properties", "value")

 

CSS ( "Properties", "value"), a plurality of modified

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<style>
.add-class{
background-color: #0f0;
padding: 5px;
border: 3px solid #000;
}
</style>
</head>
<body>
<h1>操作样式</h1>
<button id="btn">添加样式</button>
<button id="btn2">删除样式</button>
<button id="btn3">切换样式</button>
<button id="btn4"> css function modifies the style </ Button> $ (Document) .ready (function () {<Script></ HTML></ body>
<p> This is a p-tag </ p>




//css("属性","值"), 修改多个
$("#btn4").click(function () {
$("p").css({
"backgroundColor": "red",
"color": "blue"
});
});

// //css("属性","值")
// $("#btn4").click(function () {
// $("p").css("backgroundColor", "red");
// });

// //切换样式
// $("#btn3").click(function () {
// $("p").toggleClass("add-class");
// });


// //添加样式
// $("#btn").the Click (function () { // // delete the style // //});
// $ ( "P"). addClass ( "the Add-class");.



// $("#btn2").click(function () {
// $("p").removeClass("add-class");
// });
});
</script>

 

Guess you like

Origin www.cnblogs.com/zhongyehai/p/11415449.html