1、不常用的切換函數$("p").toggle();當點擊切換按鈕時,隱藏元素為P行和顯示P行;
<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$("p").toggle();
});
});
</script>
</head>
<body>
<button type="button">切換</button>
<p>This is a paragraph with little content.</p>
<p>This is another small paragraph.</p>
</body>
</html>

2、append() 函數向所匹配的 HTML 元素內部追加內容$(selector).append(content);
<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>

<script type="text/javascript">

$(document).ready(function()
{

$("button").click(function()
{
$("p").append(" <b>W3School</b>.");
});
});
</script>
</head>

<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button type="button">請點擊這里</button>
</body>

</html>

類似的還有:
$(selector).html(content) 改變被選元素的(內部)HTML
$(selector).append(content) 向被選元素的(內部)HTML 追加內容
$(selector).prepend(content) 向被選元素的(內部)HTML “預置”(Prepend)內容
$(selector).after(content) 在被選元素之后添加 HTML
$(selector).before(content) 在被選元素之前添加 HTML
3、css操作:函數 css({properties}) 同時為所有匹配元素的一系列 CSS 屬性設置值:
$(selector).css({properties})
$("p").css({"background-color":"red","font-size":"200%"});
jQuery 擁有兩種用于尺寸操作的重要函數:
- $(selector).height(value)
- $(selector).width(value)
總結如:
$(selector).css(name,value) 為匹配元素設置樣式屬性的值
$(selector).css({properties}) 為匹配元素設置多個樣式屬性
$(selector).css(name) 獲得第一個匹配元素的樣式屬性值
$(selector).height(value) 設置匹配元素的高度
$(selector).width(value) 設置匹配元素的寬度
4、AJAX:
jQuery AJAX 請求
$(selector).load(url,data,callback) 把遠程數據加載到被選的元素中
$.ajax(options) 把遠程數據加載到 XMLHttpRequest 對象中
$.get(url,data,callback,type) 使用 HTTP GET 來加載遠程數據
$.post(url,data,callback,type) 使用 HTTP POST 來加載遠程數據
$.getJSON(url,data,callback) 使用 HTTP GET 來加載遠程 JSON 數據
$.getScript(url,callback) 加載并執行遠程的 JavaScript 文件
(url) 被加載的數據的 URL(地址)
(data) 發送到服務器的數據的鍵/值對象
(callback) 當數據被加載時,所執行的函數
(type) 被返回的數據的類型 (html,xml,json,jasonp,script,text)
(options) 完整 AJAX 請求的所有鍵/值對選項
略。。。