jQuery 移动选择菜单,表单计算器适用于浏览器 Firefox,但不适用于 android。在浏览器中点击提交按钮时,它可以按预期工作,但是当我在 android 中执行此操作时,微调器会加载并发送回我的主页。
<form id="thermalgrowth">
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<label for="t">
T:
</label>
<input id="t" placeholder="" name="t" value="" type="number" step="0.001" min="0"/>
</fieldset>
</div>
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<label for="l">
L:
</label>
<input id="l" placeholder="" name="l" value="" type="number" step="0.001" min="0"/>
</fieldset>
</div>
<div data-role="fieldcontain">
<label for="c" class="select">C:</label>
<select name="c" id="c" >
<option value=".000006">Carbon Steel</option>
<option value=".0000059">Cast Iron</option>
<option value=".0000095">Stainless Steel</option>
<option value=".0000073">Nickel Steel</option>
<option value=".00001">Bronze</option>
</select>
</div>
<div class="ui-grid-a">
<div class="ui-block-a"><button id="reset" type="reset" data-theme="c" name="reset">Reset</button></div>
<div class="ui-block-b"><button id="submit" type="submit" data-theme="b" name="submit" >Submit</button></div>
</div>
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<label for="tg">
Thermal Growth
</label>
<input id="tg" placeholder="" name="tg" type="number" disabled="disabled"/>
</fieldset>
</div>
<script type="text/javascript"><!--
function calculate () {
var t = $('#t').val();
var l = $('#l').val();
var c = $('#c').val();
var tg = Number(t) * l * c ;
$('#tg').val( tg.toFixed(3) );
// submit event functions must return false,
// to tell the browser not to load a new page.
return false;
}
$('#thermalgrowth').submit( calculate );
$('#reset').click(function() {
$('#t').val('0').number('refresh');
$('#l').val('0').number('refresh');
$('#tg').val('0').number('refresh');
});
</script>
</form>