<input type="radio">のみアクセスする

書式

$(〜:radio)

説明

<input type="radio">のみアクセスするには疑似セレクタの:radioを指定します。

サンプルコード [実行]

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<link rel="stylesheet" href="main.css" type="text/css" media="all">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript"><!--
function setMargin(){
$(":radio").css("margin", "24pt");
}
// --></script>
</head>
<body>
<h1>&lt;input type="radio"&gt;のみ余白(マージン)を変更する</h1>
<form>
<input type="button" value="余白を設定" onClick="setMargin()"><br>
<input type="text" value="テキストフィールド"><br>
<input type="password" value="jquery">パスワード<br>
<input type="radio" name="cpuType">ラジオボタン1<br>
<input type="radio" name="cpuType">ラジオボタン2<br>
<input type="radio" name="cpuType">ラジオボタン3<br>
<input type="checkbox">チェックボックス<br>
<input type="checkbox" checked>チェックボックス<br>
<input type="checkbox">チェックボックス<br>
<input type="file">ファイル選択<br>
<input type="button" value="ただのボタン"><br>
<input type="reset" value="リセットボタン"><br>
<input type="submit" value="送信ボタン"><br>
<textarea cols="20" rows="10">ここはテキストエリアです</textarea>
</form>
</body>
</html>