Not entirely sure how I can phrase this question correctly, my apologies for that. What I want to happen here is that the "output" is displayed right next to the slider, and not beneath it.
To see what is wrong: alainbruno.nl/form.html
At any rate, I'm just starting with HTML5, and this is the code so far:
<!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>
Just make the <div>
that holds that value a <span>
so it displays inline
:
<p>
<label for="range">Select Age:</label>
<input type="range" min="14" max="60" id="slider" value="10" name="range">
<span id="output"></span>
</p>
See this Plunk: http://plnkr.co/edit/ELffjF?p=preview
Alternatively, you could use css to set that <div>
to display:inline
, but that'd be an anti-patten IMHO, seeing as <span>
exists, and is, by default display:inline