gpt4 book ai didi

javascript - 只有IE8 html文本框中的字符

转载 作者:行者123 更新时间:2023-11-29 09:55:37 25 4
gpt4 key购买 nike

我想限制用户只能在 html 文本框中输入字符。我正在使用以下代码

 $('.alphaonly').live("input", function () {
$(this).val($(this).val().replace(/[^A-Za-zÀ-ÿ ]/g, ''));
});

这在 IE9 中工作正常,但在 IE8 中失败。

谁能帮我解决问题?

最佳答案

我的意思是使用插件更容易:

http://www.thimbleopensource.com/tutorials-snippets/jquery-plugin-filter-text-input

$('#text_input').filter_input({regex:'[a-z]'}); 

关于javascript - 只有IE8 html文本框中的字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12318552/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com