不完全确定如何正确表达这个问题,对此我深表歉意。我想要在这里发生的是“输出”显示在滑块旁边,而不是在它下面。
看看有什么问题:alainbruno.nl/form.html
无论如何,我只是从 HTML5 开始,这是到目前为止的代码:
<!DOCTYPE html>
<html lang = "en">
<head>
<title>Character Creation</title>
</head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
$(function(){
//Range
var val = $('#slider').val();
output = $('#output');
output.html(val);
$('#slider').on('change', function(){
output.html(this.value);
});
});
</script>
<body>
<h1>Form</h1>
<form>
<fieldset>
<legend>Appearance</legend>
<p>
<label>
Select Race:
</label>
<select id="Race">
<option value="human">Human</option>
<option value="faela">Faela</option>
<option value="domovoi">Domovoi</option>
<option value="arcon">Arcon</option>
<option value="tsaaran">Tsaaran</option>
</select>
</p>
<p>
<label>Select Gender</label>
<select id="Gender">
<option value="male">Male</option>
<option value="female">Female</option>
<option value="other">Other</option>
</select>
</p>
<p>
<label for="range">Select Age:</label> <input type="range" min="14" max="60" id="slider" value="10" name="range"> <div id="output"></div>
</p>
</fieldset>
</form>
</body>
</html>