以下のHTMLを指定すると、with-stamp
クラスを持つ<option>
を選択するjQueryセレクタが必要です。jQueryセレクタ<select>の<option>ボックス
<select name="preset_select">
<option selected="selected" value="original">ORIGINAL</option>
<option value="large">LARGE</option>
<option class="with-stamp" value="medium">MEDIUM</option>
</select>
$("select[name=preset_select]").change(function() {
// console.log($(this).hasClass("with-stamp")); // all false
// console.log($("select[name=preset_select] option").hasClass("with-stamp")); // all true
});
ありがとう、まず私は動作しないと思ったが、私はあなたが私のクラス名を変更したことを見た:-) – FFish
おかげで申し訳ありません。 あなたはそれを理解してうれしい:) – PeeHaa