久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      jquery val()方法怎么用

      在jquery中,val()方法可以用于返回第一個(gè)匹配元素的value屬性的值,語法“$(selector).val()”;也可用于設(shè)置所有匹配元素的value屬性的值,語法“$(selector).val("新值")”。

      jquery val()方法怎么用

      本教程操作環(huán)境:windows7系統(tǒng)、jquery1.10.2版本、Dell G3電腦。

      jquery val()方法

      在jquery中,val()方法用于返回或設(shè)置被選元素的 value 屬性的值。

      • 當(dāng)用于返回值時(shí):

        該方法返回第一個(gè)匹配元素的 value 屬性的值。

      $(selector).val()
      • 當(dāng)用于設(shè)置值時(shí):

        該方法設(shè)置所有匹配元素的 value 屬性的值。

      $(selector).val(value)  //通過函數(shù)設(shè)置 value 屬性: $(selector).val(function(index,currentvalue))

      jquery val()方法怎么用

      示例1:返回第一個(gè)匹配元素的 value 屬性的值。

      <!DOCTYPE html> <html>  	<head> 		<meta charset="UTF-8"> 		<script src="js/jquery-1.10.2.min.js"></script> 		<script> 			$(document).ready(function(){ 				$("button").click(function(){ 					alert($("input").val()); 				}); 			}); 		</script> 	</head> 	<body>  		喜歡的水果: <input type="text" name="fname" value="蘋果"><br><br> 		<button>返回輸入字段的值</button> 	</body> </html>

      jquery val()方法怎么用

      示例2:設(shè)置 <input> 字段的值

      <!DOCTYPE html> <html>  	<head> 		<meta charset="UTF-8"> 		<script src="js/jquery-1.10.2.min.js"></script> 		<script> 			$(document).ready(function(){ 				$("button").click(function(){ 					$("input").val("榴蓮"); 				}); 			}); 		</script> 	</head> 	<body>  		喜歡的水果: <input type="text" name="fname" value="蘋果"><br><br> 		<button>設(shè)置輸入字段的值</button> 	</body> </html>

      jquery val()方法怎么用

      【推薦學(xué)習(xí):jQuery視頻教程、web前端開發(fā)視頻】

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)