Fairly new to jQuery library, I'm trying to implement the following:
I've managed to bind the values of the control group to a variable, but I want to offer the user the possibility to enter a custom value in the spinner attached to the "Custom" checkbox.
Here are samples of the code I'm working on: (JavaScript)
$(function() {
/** Truncated code **/
var intervalId, intervalDelay = 1000;
var spinner = $( "#spinner" ).spinner();
function handleSpeed(e) {
intervalDelay = $(e.target).val();
};
$(".speed-bar").controlgroup();
$("[name='speed']").on( "change", handleSpeed);
$("[name='speed']").checkboxradio({
icon: false
})
} );
HTML:
<div class="speed-wrap">
<div class="speed-bar">
<label for="speed-rt">Real Time (2mn)</label>
<input type="radio" name="speed" id="speed-rt" value=120000>
<label for="speed-2x">x2 (1mn)</label>
<input type="radio" name="speed" id="speed-2x" value=60000>
<label for="speed-5x">x5 (24s)</label>
<input type="radio" name="speed" id="speed-5x" value=24000>
<label for="speed-60x">x60 (2s)</label>
<input type="radio" name="speed" id="speed-60x" value=2000 checked>
<label for="custom">Custom</label>
<input type="radio" name="speed" id="custom">
<input id="spinner" name="spinner">
</div>
</div>
Side-quest: Is there an easy way to make the spinner height the same as the other buttons?
spinner.height(15);