是否可以使用 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;
}