jquery - 如何用 jQuery 只填充两个输入中的一个输入?

标签 jquery html css

我有五个输入,其中一个名为 check 的类。如何使用 jQuery 仅填充五个输入的输入?

我不能使用验证器 jQuery 库。

这是 html 文件:

<input class="cheque" id="chmomtaz" placeholder="ریال" type="text" style="width: 100%" >
<input class="cheque" id="chkimia" placeholder="ریال" type="text" style="width: 100%" >
<input class="cheque" id="chrash" placeholder="ریال" type="text" style="width: 100%" >
<input class="cheque" id="chsandal" placeholder="ریال" type="text" style="width: 100%" >
<input class="cheque" id="chchob" placeholder="ریال" type="text" style="width: 100%" > 

最佳答案

@hasan movahed 你的解决方案会起作用,但是,如果我了解你的需求,可以这样:

$('.cheque').on("keyup", function() {
    $('.cheque').not(this).val('');
});

这将删除所有其他输入内容而不禁用它们

关于jquery - 如何用 jQuery 只填充两个输入中的一个输入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39314923/

相关文章:

html - 裁剪图片而不是随页面调整大小

javascript - .slidetoggle 在 jquery 中单独的 div

javascript - Bootstrap javascript的加载顺序

javascript - 如何根据本地存储的数据切换主题

php - 如何将这个 <ul> 居中?

javascript - 如何检查 head 中是否包含 css/js 资源

CSS 下拉子菜单 z-index 消失在主菜单后面

javascript - 图像比 Canvas 上的原始图像小以制作drawImage()

javascript - 动画不工作,循环卡住

html - 当我使用 "flow: left"时,DIV 在同一行中变成一秒而不是一秒