如何隐藏label
需求虐我千百遍
不多说,上代码
// An highlighted block
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
</head>
<body>
<form>
<label for="male">Male</label>
<input type="radio" name="sex" id="male" />
<br />
<label for="female">Female</label>
<input type="radio" name="sex" id="female" />
</form>
<script>
document.querySelector('[for="male"]').style.display='none'
$("#male").attr("style", "display:none");
</script>
</body>
</html>