jquery練習2筆記

<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
 var fields = $("#fm").serializeArray();
jQuery.each( fields, function(i, field){
 $("#results").append(field.value + " ");
});$("#fm").change(function(){ fields = $("#fm").serializeArray();$("#results").text("");
jQuery.each( fields, function(i, field){
 $("#results").append(field.value + " ");
});
 
});
});
</script>
</head>
<body>
<p id="results"><b>Results:</b> </p>
<form id="fm">
 <select name="single">
    <option>Single</option>
    <option>Single2</option>
 </select>
 <select name="multiple" multiple="multiple">
    <option selected="selected">Multiple</option>
    <option>Multiple2</option>
    <option selected="selected">Multiple3</option>
 </select><br/>
 <input type="checkbox" name="check" value="check1" checked="checked"/> check1
 <input type="checkbox" name="check" value="check2" /> check2
 <input type="radio" name="radio" value="radio1" checked="checked"/> radio1
 <input type="radio" name="radio" value="radio2"/> radio2
</form>
</body>
</html>
 
1、 change事件
2、 append 增加
3
var fields = $("#fm").serializeArray();
jQuery.each( fields, function(i, field){
 $("#results").append(field.value + " ");
}); 遍歷每個控件值

網(wǎng)頁題目:jquery練習2筆記
網(wǎng)站URL:http://bm7419.com/article2/jcigoc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供營銷型網(wǎng)站建設(shè)App設(shè)計、品牌網(wǎng)站設(shè)計品牌網(wǎng)站建設(shè)、電子商務(wù)、網(wǎng)站營銷

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)