Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次の条件でテキストの検証を行う必要があります。
私は.NetJavaScriptが初めてです。誰かがそれを行う方法を提案できますか?
.Net
「keyup blur」イベント ハンドラーで次のコードを使用します。
$(function() { $('input.alpha[$id=tb1]'.bind('keyup blur', function() { if (this.value.search(/^[a-zA-Z]*$/) === -1) { alert("Only valid characters present"); } }); });
正規表現に空の一致を許可したくない場合は、* の代わりに + を使用します。