jquery支持所有的css選擇器
* * *
操作流程
1.打開網站

2點擊jquery
.
3.獲取粘貼在title的上方

* * *
### 獲取dom節點
~~~
var test = $('#test');
~~~

~~~
test.click(function(){
console.log("hello world")
~~~
事件
~~~
$(selector).css({})
$(selector).html()
~~~
改變樣式與內容
~~~
test.click(function(){
$(this).css({color:"red",backgroundColor:"yellow"}).html("change")
})
~~~
* * *
點擊變色
~~~
<style>
li{
cursor: pointer;
}
.active{
color:red;
//active類顯示紅色
}
</style>
</head>
<body>
<ul>
<li class="active">手機</li>
<li>平板</li>
<li>電腦</li>
</ul>
<script>
/* 點擊li,讓當前項添加active-class,讓兄弟項移除active-class */
$("li").click(function(){ $(this).addClass('active').siblings().removeClass('active')
})
// siblings :獲取兄弟元素
</script>
</body>
*****
~~~
- 第一章 git
- 1.1 git基本語法
- 1.2 版本回退
- 1.3 ssh的配置
- 第二章 markdown基本語法
- 第三章 HTML CSS
- 3.1 html基礎知識
- 3.2 css基礎
- 3.3 img垂直居中
- 3.4 清除鼠標懸停抖動
- 3.5 字體、列表、表格、文本、鏈接樣式
- 3.6 屬性繼承
- 3.7 float
- 3.8 定位
- 3.9 li加邊框文字移動問題
- 3.10 title旁邊的小圖標
- 第四章 Vue
- 4.1
- 第五章 JavaScript
- 5.1 基本語法
- 5.2 DOM事件
- 5.3 事件
- 5.4 jQuery引用
- 5.5 顯示與隱藏
- 5.6 回到頂部
- 第六章 jQuery
- 6.1 基礎語法