<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<div class="xuhaitao">123</div>
<span>dddd</span>
<p>xuguozhu</p>
<div>111</div>
<div class="xuhaitao"><span>456</span></div>
<span>dddd</span>
<form>
<input type="text" /><br/>
<input type="text" name="xu2" /><br/>
<input type="text" name="xu3eeee" /><br/>
<select>
<option>xu1</option>
<option>x2u</option>
<option>xu3</option>
</select>
<br/> 用户名 <input type="text" name="usernamme" placeholder="xbn" /><br/>
<br/> 密码 <input type="password" name="pwd" /><br/>
<input type="text" name="xxxuy" style="display: none " /><br/>
<input type="checkbox" name="gua" value="huanggua01" style="background: red; " checked/>皇瓜1<br/>
<input type="checkbox" name="gua" value="huanggua02" checked/>皇瓜2<br/>
<input type="checkbox" name="gua" value="huanggua03" />皇瓜3<br/>
<div>
<input type="radio" name="rad" value="radio01 " checked/>radio01<br/>
<input type="radio" name="rad" value="radio02 " />radio02<br/>
</div>
<div>
<input type="radio" name="rad22" value="radio01" checked/>radio03<br/>
<input type="radio" name="rad22" value="radio02" />radio04<br/>
</div>
<p id="xx">sss</p>
<button>海洋海洋</button>
</form>
<script>
var yonghuming = $(":input:hidden")[0].name;
console.log(yonghuming); //xxxuy
var pwdd = $(":password")[0].name;
console.log(pwdd); //pwd
var usrname = $(":text[name=usernamme]")[0].name;
console.log(usrname); //usernamme
$(":input").css("background", "red ");
var gua = [];
$(":checkbox:checked").each(function() {
gua.push(this.value);
})
console.log("_____________" + gua.length);
gua.forEach(function(val, index) {
alert(val)
})
var radd = $(":radio[name=rad22]:checked").length;
console.log(radd);
</script>
</body>
</html>
?
|