あなたは(.blurを望むことでしょう);?機能。要素は、「フォーカス」を持ち、ユーザが「集中」の項目を残し、「ぼかし」は呼び出され、バック要素にイベントを送信するたびに。フォローする例を。
if(focusedElement == ""){
//if our focused element is empty
$('#text2display').live('blur', function(){
//when the target loses focus, we invoke blur, the next line focuses again.
//it's also a best practice to do something like fading in the border,
$("#text2display").focus();
});
}
また、私が提案する可能性がある場合その要素にフォーカスが戻ってきたことをユーザーに知らせることをお勧めします。これを行う最も良い方法は、「赤い」枠を追加し、その枠線をフェードアウトすることです。 - >
また
if(focusedElement == ""){
//if our focused element is empty
$('#text2display').live('blur', function(){
//when the target loses focus, we invoke blur, the next line focuses again.
//it's also a best practice to do something like fading in the border,
$("#text2display").focus(function(){
$(this).animate({
//when the element has been re-focused, we'll give it a red border briefly.
borderColor: '#ff0000';
}, function(){
//once the animation completes, fade the border out
$(this).animate({ borderColor: 'transparent' }, 2000);
}
);
});
});
}
、我々は問題のサイズを変更したくないので、私たちは、これがあなたのためにうまく動作するはずです私たちの入力に
input{
border:1px solid transparent;
}
をいくつかのCSSを追加する必要があります。
これはどのブラウザで実行されますか?モバイルデバイスかデスクトップですか? –