jQuery Mobile 表單 - 滑塊
jQuery Mobile 滑塊控件
滑塊允許您從一定范圍內(nèi)的數(shù)字中選取值:
如需創(chuàng)建滑塊,請(qǐng)使用 <input type="range">:
實(shí)例
<form method="post" action="demoform.asp">
<div data-role="fieldcontain">
<label for="points">Points:</label>
<input type="range" name="points" id="points" value="50" min="0" max="100">
</div>
</form>
使用下列屬性來規(guī)定限定:
- max - 規(guī)定允許的最大值
- min - 規(guī)定允許的最小值
- step - 規(guī)定合法的數(shù)字間隔
- value - 規(guī)定默認(rèn)值
提示:如果您希望突出顯示截止滑塊值的這段軌道,請(qǐng)?zhí)砑?data-highlight="true":
實(shí)例
<input type="range" data-hightlight="true"
>
切換開關(guān)
切換開關(guān)常用于開/關(guān)或?qū)?錯(cuò)按鈕:
如需創(chuàng)建切換,請(qǐng)使用 data-role="slider" 的 <select> 元素,并添加兩個(gè) <option> 元素:
實(shí)例
<form method="post" action="demoform.asp">
<div data-role="fieldcontain">
<label for="switch">Toggle Switch:</label>
<select name="switch" id="switch" data-role="slider">
<option value="on">On</option>
<option value="off">Off</option>
</select>
</div>
</form>
提示:請(qǐng)使用 "selected" 屬性來把選項(xiàng)之一設(shè)置為預(yù)選(突出顯示):
實(shí)例
<option value="off" selected
>Off</option>