我正在使用 jquery keyup 方法将字母转换为大写,现在可以使用。但是我如何添加异常,以便我的 txtEmail
id 不会转换为大写
<input runat="server" clientidmode="static" type="text" id="txtEmail" value="" />
//Only this emaild should not get change to uppercase
<input runat="server" clientidmode="static" type="text" id="txtAdd1" value="" />
jQuery:
$("input[type=text]").keyup(function () {
$(this).val($(this).val().toUpperCase());
});
我无法更改 HTML 标记。我想在 jquery 本身中完成它。
最佳答案
尝试.not()
$("input[type=text]").not('#txtEmail').keyup(function () {
<小时/>
还可以使用 this.value
而不是 $(this).val()
更快。
<小时/>
fiddle 作者:jagruti
关于jquery keyup 事件取决于 id 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20072366/