Javascript禁用用于更改密码文本框的空格键 [英] Javascript disable space key for change password textboxes
本文介绍了Javascript禁用用于更改密码文本框的空格键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
,大家好,
var veri = {
YeniSifreTextBox: $('#YeniSifreTextBox_I').val(),
YeniSifreTekrarTextBox: $('#YeniSifreTekrarTextBox_I').val(),
};
if (veri.YeniSifreTextBox == '' || veri.YeniSifreTekrarTextBox == '') {
alert("Password Can not be empty!");
}
else if (veri.YeniSifreTextBox != veri.YeniSifreTekrarTextBox) {
alert("Passwords dont not match !");
}
我可以控制密码不能为空,并且密码与以上代码不匹配.
I can control password can not be empty and passwords dont not match with above codes.
我想在用户输入密码时禁止输入空格键.
I want to disable to enter space key while user write password.
用户切勿在2个文本框内使用键盘上的空格.
User must never use space in keyboard inside of 2 textboxes.
1.textbox YeniSifreTextBox_I
1.textbox YeniSifreTextBox_I
2.textbox YeniSifreTekrarTextBox_I
2.textbox YeniSifreTekrarTextBox_I
推荐答案
您可以使用下面的javaScript代码来阻止空格键
You can use the below javaScript code to block the space key,
function RestrictSpace() {
if (event.keyCode == 32) {
return false;
}
}
HTML
<textarea onkeypress="return RestrictSpace()"></textarea>
希望这对您有所帮助.
这篇关于Javascript禁用用于更改密码文本框的空格键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文