0

バリデーターを作成する必要があります。

バリデーターは、唯一の 2 文字だけを拒否し" ,、残りの文字を受け入れる必要があります。

これが私の現在のコードです

<input type="text"/>​

$(document).ready(function () {    
    $('input').keyup(function() {
        var $th = $(this);
        $th.val( $th.val().replace(/[^a-zA-Z0-9]/g, function(str) { alert('You typed " ' + str + ' ".\n\nPlease except.'); return ''; } ) );
    });
});​

デモ

4

1 に答える 1