jQueryを使用して各ラジオボタンに独自の背景画像を与えることは可能でしょうか? つまり、次のとおりです。
<form id="tiepspiel" name="tiepspiel" action="#" method="POST">
<ul id="sortable">
<?php
$count = 5;
$i = 1;
while ($i <= $count) {
echo '<li><ul class="elements">
<li class="selectable">
<label class="stein"><input type="radio" name="selected__'.$i.'" value="stein</label>
<span></span>
</li>
<li class="selectable">
<label class="schere"><input type="radio" name="selected_'.$i.'" value="schere"></label>
<span></span>
</li>
<li class="selectable">
<label class="papier"><input type="radio" name="selected_'.$i.'" value="papier"></label>
<span></span>
</li>
</ul>
</li>';
$i++;
}
?>
<hr>
<button>Submit</button>
</ul>
</form>
各クラスにCSSを追加しようとしています。例えば:
.papier {
background-image: url("../images/papier_blue.png");
width: 82px;
height: 82px;
cursor: pointer;
margin-right: 50px;
}