在使用滑块填充数字时,我一直在尝试更改for循环中的类。使用滑块时,该类保持不变。
输入字段name="cijfer[]" id="ex'.$i.'
已正确填充滑块中的数字。
有任何改变代码以使其正常工作的建议吗?
非常感谢帮助。
while($row = mysqli_fetch_array($res))
{ $i++;
echo'
<div class="container">
<input type="hidden" class="form-control" id="id_inh[]" name="id_inh[]" value="'.$row['id'].'">
<div class="form-group col-md-6">';
if($i == 1) { echo '<label>Besproken punten</label>'; } echo'
<textarea class="form-control" style="min-width: 100%" rows="4" id="optie[]" name="optie[]" onmouseover="validate()">'.$row['optie'].'</textarea>
</div>
<div class="form-group col-md-6">';
if($i == 1) { echo '<label>Feedback tijdens functioneringsgesprek</label>'; } echo'
<textarea class="form-control" style="min-width: 100%" rows="3" id="opmerking[]" name="opmerking[]" onmouseover="validate()">'.$row['opmerking'].'</textarea>
<input id="ex'.$i.'" type="text" data-slider-min="1" data-slider-max="10" data-slider-step="1" data-slider-value="" class="slider_darko"/>
<span id="ex'.$i.'CurrentSliderValLabel"> Cijfer: <span id="ex'.$i.'SliderVal"></span> </span> <span class="glyphicon glyphicon-warning-sign" id="cijfer_status[]"></span>
<input name="cijfer[]" id="ex'.$i.'_slider_value" type="hidden" value="'.$row['cijfer'].'" onChange="calculatie(this, <?php echo $i ?>)" />
<input name="i_val" id="i_val" type="hidden" value="'.$i.'" />
</div>
</div>';
}
<script type="text/javascript">
function calculatie(selectVeld, nr)
{
if (document.getElementsByName('cijfer').value == false)
{
document.getElementById('cijfer_status')[nr].className = "glyphicon glyphicon-warning-sign";
}
else
{
document.getElementById('cijfer_status')[nr].className = "glyphicon glyphicon-ok";
}
}
</script>