search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

jQuery02 使用CSS方式當選擇器實作 元件隱藏+元件選取+事件指定 – jashliao部落格

jQuery02 使用CSS方式當選擇器實作 元件隱藏+元件選取+事件指定

 

 

資料來源http://www.w3school.com.cn/jquery/index.asp

code2html:http://tohtml.com/

 









<html>
<head>
<title>jQuery 使用CSS方式當選擇器實作 元件隱藏+元件選取+事件指定title>

<scriptsrc="http://code.jquery.com/jquery-1.11.3.min.js">script>
<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">script>
<script>
/*
		$(this).hide()
		演示 jQuery hide() 函数,隐藏当前的 HTML 元素。
		$("#test").hide()
		演示 jQuery hide() 函数,隐藏 id="test" 的元素。
		$("p").hide()
		演示 jQuery hide() 函数,隐藏所有 

元素。

$(".test").hide() 演示 jQuery hide() 函数,隐藏所有 class="test" 的元素。 */ $(document).ready(function(){ /* //所有p都指定事件 $("p").click(function(){ $(this).hide();//指定目前元件執行隱藏動作 }); */ //單純使用ICSS ID當選擇器 $("#test").click(function(){ $(this).hide();//指定目前元件執行隱藏動作 }); //單純使用ICSS ID當選擇器 $(".test").click(function(){ $(this).hide();//指定目前元件執行隱藏動作 }); }); script> head> <body> <pid="test">如果您点击我,我会消失。p> <pclass="test">点击我,我会消失。p> <p>也要点击我哦。p> body> html>

 

 




熱門推薦

本文由 jashliaoeuwordpress 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦