まだデータがありません。
:imageセレクター
当ページのリンクには広告が含まれています。
スポンサーリンク
jQueryの:imageセレクターの解説をします。
:imageセレクターは、type属性がimageのinput要素を選択するフィルターです。
<input type="image" />
サンプル/デモ
では、「:imageセレクター」の動きを簡単なサンプルで確認してみましょう。
サンプルでは、「送信」(type属性がimageのinput要素)にcssを追加するように設定しています。
<script>
$(document).ready(function () {
$(":image").addClass("add-css");
});
</script>
ソース( HTML + jQuery )
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="description" content=":imageセレクターのサンプル/デモでーす。">
<title>:imageセレクター - jQuery入門</title>
<script src="http://code.jquery.com/jquery-2.0.0.js"></script>
</head>
<body>
<form>
<input type="botton" />
<input type="image" src="image-button.png" alt="画像のボタン" />
<input type="radio" />
<input type="reset" />
</form>
</body>
<style>
.add-css {
border: 5px double red;
}
</style>
<script>
$(document).ready(function () {
$(":image").addClass("add-css");
});
</script>
</body>
</html>
「画像ボタン(type属性がimageのinput要素)」にcssが追加されていることがわかります。
スポンサーリンク
