weixin_33709590 2015-10-29 12:57 采纳率: 0%
浏览 28

通过jQuery过滤输入的价格

i have a form in which user input the price and im unable to validate the price here is the code below

 <input placeholder="e.g 22,000" type="text" id="salary" name="salary">
 jQuery("#salary").validate({
     expression: "if (VAL.match(/^[0-9,]{3,10}$/)) return true; else return 
     false;", 
     message: "Please enter Correct Salary"

 });

Now whenever a user enter 15000 it should automatically put comma like this "15,000" and if he enters in lakh then like this 1,50,000

  • 写回答

1条回答 默认 最新

  • 笑故挽风 2015-10-29 13:12
    关注

    It's better to use HTML5 input elements with their patterns (you can import libs for older browsers), also plz check this link: HTML 5 Currency format

    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵