donglu9134 2017-09-29 14:29
浏览 369
已采纳

Bootstrap表单输入浮点值问题

I have used bootstrap 4 framework in my website. Using this framework I have created a simple html form using bootstrap class with javascript function.

The form works good while i enter integer as input, But it shows some error while i enter float vales.

Here is the web-page.

<form role="form" name="BeamFactor">    
    <div class="form-group">            
        <label>Antenna dimension (D) :</label>
        <input class="form-control input-lg" name="n1" required="" type="number"> 
    </div>      
    <div class="form-group">        
        <label>Wavelength (λ) :</label><input class="form-control input-lg" name="n2" type="number"> 
    </div>      

    <div class="form-group">        
        <label>Beamwidth :</label><input class="form-control input-lg" name="n3" type="number"> 
    </div> 

    <div class="form-group">            
        <input value="Calculate" class="btn btn-success btn-lg" onclick="javascript:calcBeamFactor();" type="button">   
        <button type="reset" class="btn btn-warning btn-lg">Reset</button> 
    </div>      

    <div class="form-group">        
        <label>BF :</label><input class="form-control input-lg" name="total"> 
    </div>
</form>
  • 写回答

1条回答 默认 最新

  • doubi1797 2017-09-29 14:32
    关注

    Add step property to your input type.

    <input type="number" step="any" />
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 matlab求解平差
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办