[quote=引用 1 楼 weixin_50944805 的回复:]在网页上修改如身份证号,是使用input来吗。如果是,那么限定类型 type="number" ,更好的做法是给一个input事件,在用户输入的时候验证。 如果是这个方式: 1、添加contenteditable属性让文本处于可编辑状态,<p contenteditable="true">这里可以编辑</p> contenteditable: "inherit";(默认) contenteditable: "plaintext-only";(输入纯文本) contenteditable: "true"; contenteditable: "false"; contenteditable: "caret";(符号) contenteditable: "events";(不知道搞啥用的) 2、利用css的user-modify user-modify: read-only; user-modify: read-write; user-modify: write-only;(暂不支持) user-modify: read-write-plaintext-only;(输入纯文本,暂时只有谷歌支持: 我就没有研究过了
我用xlsx这个插件做了个简单的demo可以进行重复字符的对比生成新表格并导出了,但是 xlsx插件?哪有demo?
建议使用input标签来修改。 // 如性别 给性别输入框类名 sex $('body').on('input', 'input.sex', function(){ if(['男', '女'].indexOf(this.value) == -1){ this.value = '' alert(''只能输入,男/女); } })
// 如性别 给性别输入框类名 sex $('body').on('input', 'input.sex', function(){ if(['男', '女'].indexOf(this.value) == -1){ this.value = '' alert(''只能输入,男/女); } })
在网页上修改如身份证号,是使用input来吗。如果是,那么限定类型 type="number" ,更好的做法是给一个input事件,在用户输入的时候验证。 如果是这个方式: 1、添加contenteditable属性让文本处于可编辑状态,<p contenteditable="true">这里可以编辑</p> contenteditable: "inherit";(默认) contenteditable: "plaintext-only";(输入纯文本) contenteditable: "true"; contenteditable: "false"; contenteditable: "caret";(符号) contenteditable: "events";(不知道搞啥用的) 2、利用css的user-modify user-modify: read-only; user-modify: read-write; user-modify: write-only;(暂不支持) user-modify: read-write-plaintext-only;(输入纯文本,暂时只有谷歌支持: 我就没有研究过了
87,996
社区成员
224,708
社区内容
加载中
试试用AI创作助手写篇文章吧