- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试在 android cordova 3.5.0 应用程序中实现一个输入字段,如下所示:
<input type="text" maxlength="7" class="form-control" placeholder=" "/>
但是 maxlength 根本不起作用。
我尝试了如下使用 javascript 的工作:
function checkTestPressure(txtBox){
if(txtBox.value.length > 7){
console.log(" txtBox = "+ txtBox.value.length);
var str = txtBox.value;
str = str.substr(0,7);
txtBox.value = str;
}
}
html如下:
<input type="text" maxlength="7" class="form-control" onkeyup="checkTestPressure(this);" onblur="trimWhiteSpacesForTextBox(this);" id="testpressure" placeholder=" ">
这起初有效,但如果我在 7 位数字后继续敲击键盘上的键,输入文本字段将变为空,并随着我不断按下键而开始重新填充。
这是 Not Acceptable ,我只需要前 7 个字符,无论我按键盘上的键多少次,都不应填充该字段。
上面的代码在桌面浏览器中运行良好,但是当我在 cordova android 应用程序中运行时出现上述问题。
感谢任何帮助。
提前致谢。
最佳答案
有点晚了,但是你可以使用这个属性来完成禁用文本更正/修改。
<input
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false">
关于javascript - maxlength 在 cordova android 应用程序的输入类型文本中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26010588/
我需要以某种方式将模型的 max_length 约束 Hook 到 Form 对象中。 假设我定义了一个带有字段的模型:name = models.CharField(max_length=30)现在
“On input while maxlength is active trigger even if maxlength is reached”,这是on input事件的经典用法。当达到 maxl
我正在尝试配置一个 TextView,它的 maxLines=3 并且它的每一行都有 maxLenght=30。 感谢您的帮助。 最佳答案 您可以对实际的 30 个字符使用 maxWidth 函数(平
在表单组验证中,我尝试应用输入最大长度,但是,这个最大长度取决于表单中的其他操作。如果它们改变,也改变 maxMsgLength 的属性值。 消息:['', Validators.maxLength(
我有一个 iOS 应用程序,我在其中使用 NSInputStream(基于 CFReadStreamRef)从网络套接字读取数据。我不断从服务器获取数据,并不断读取和处理它(使用 read:bytes
我的输入字段包含数字和特殊字符,例如逗号和点在计算字段的 maxLength 时,我想跳过特殊字符。 我不想限制特殊字符。 预期输出应为:- 1,234(总长度:- 4) Userna
我只是在忙着弄清楚 cakephp,看起来它会很有趣。 我有一个表单输入,如下所示: echo $form->input('Campaign.title', array('maxLength'=>'7
旧的 ng-maxlength="5"用于触发字段错误,但会继续允许用户输入。 maxlength="5"似乎在阻止输入。当我的表格上有 novalidate 时,这样做是否有 Angular ?当我
我对 AllenNLP 还很陌生,我目前正在使用它的预训练问答模型。我想知道它是否有 channel 长度限制以确保其性能?我知道 BERT 的最大长度为 512,并且会截断更长的段落。 我在 All
我正在处理 TFS 流程模板的自定义工作项,但收到错误指示我用于组控件的标签超过 MaxLength 值。谁能告诉我我可以贴在群组标签上的最大长度是多少? 最佳答案 如您所见,答案是 80。这是官方文
下面是我在注册和登录表单上使用的代码,限制用户输入有限数量的字符: $( "#limit1" ).attr('maxlength','11').on('input', function() { if
我使用的是 Entity Framework 4.3.1,代码优先,并在 SQL Profiler 中查看正在生成的查询。这是一个例子: 如您所见 - 它将参数指定为 nvarchar(max) 但在
我在互联网上发现输入的最大长度是: 524288 个字符 我找不到有关 textArea 的任何信息。 我需要传递一个最多 1 500 000 个字符的 var,因此我尝试找到类似于输入文本或可用于此
使用 jQuery 版本 1.2.3,我尝试在具有属性“maxlength”的 textarea 元素之后添加节点,但它不起作用: $("textarea[@maxlength]").after("A
我使用 Javascript 添加新的文本字段: var input = document.createElement("input"); input.type = "text"; input.nam
好的,所以我正在构建一个自定义注册页面,当然还涉及到 javascript 输入验证。 在该验证中,我使用了 maxlength 属性来验证输入的长度 - 这是一种双重安全,但很容易获得我认为的元素的
基本上,我正在向所有文本框动态添加 maxLength,但我想向那些没有 maxLength 的文本框添加默认 maxLength属性集。 如何使用 jquery、javascript 完成此操作?
我的 html 页面有问题 这里是页面的简化版本 function maxLength() {
我对 ASP.NET MVC3 客户端验证有一个奇怪的问题。我有以下类(class): public class Instrument : BaseObject { public int Id
我在 Vue 中有一个表单,由于电话号码输入的样式原因,它有一些组合输入。 我的问题是用户必须点击 Tab 键才能转到电话号码的下一个输入字段。 有没有办法检查当前和输入的最大长度,并在满足时转到下一
我是一名优秀的程序员,十分优秀!