I try to generate a simple button by HTML and JavaScript. Unfortunately, I don't know how to it with JavaScript to catch to value from input range HTML to apply for button. How could I use JavaScript to catch value from HTML range? this is my html code:
<form name='frm'>
<div id="div">
<label>
Width:
<input type="text" id="MyText"/>
<input type="range" id="MyRange" oninput="myfunc()"/>
</label><br/>
<label>
Height:
<input type="text" id="height"/>
<input type="range" id="heights" oninput="myfunc()"/><br/>
</label><br/>
<label>
Background:
<input type="text" id="bdg"/>
<input type="color" id="background"/>
<!--/* <input type="range"/>
<input type="imge" name="imge"/>*/-->
</label><br/>
<label>
Radius:
<input type="text" name="rad" id="Radius"/>
<input type="range" name="rad" id="Rd"/><br/>
</label><br/>
<label>
Margin:
<input type="text" name="margin" id="margin"/><br/>
</label><br/>
<label>
Padding:
<input type="text" name="padding" id="padding"/><br/>
</label><br/>
<label>
Box-shadow:
<input type="text" name="shadow" id="shadow"/><br/>
</label><br/>
</div>
<div id="div">
<label>
Color:<br/>
<input type="text" name="col" id="color"/>
<input type="color" id="colors"/><br/>
</label>
<label>
Border-width:<br/>
<input type="text" name="bdwidths" id="bw"/>
<input type="range" id="bdw"/><br/>
</label>
<label>
Border-style:<br/>
<input type="number" name="bdstyle" id="bdstyle"/><br/>
</label>
<label>
Border-color:<br/>
<input type="number" name="bdcol" id="bdcolor"/>
<input type="color" id="color"/><br/>
</label>
<label>
Text-align:<br/>
<input type="number" name="aligns" id="ta"/><br/>
</label>
<label>
Font-size:<br/>
<input type="number" name="font" id="font"/>
<input type="range" id="font-size"/><br/><br/>
</label>
<label>
<input type="button" value="save change" onclick="save()"/>
</label>
</div>
</form>
My Button
document.frm['widths'].valueyou will need to keep the names unique. Personally I would give the elements ID's. I'm just posting this as a second solution. If you don't keep the elements names unique you can access them usingdocument.frm['widths'][0].value-document.frm['widths'][1].valueThe first element with will use[0]and the second will use[1]. I'm sure you can work out how that increments.