要素が更新されたときに要素の背景色を変更しようとしています。
サーバーから応答が返ってきたら、要素の背景色を 1 秒ほど変更してから、元に戻します。背景色は変更できますが、同じ呼び出しで元に戻すことはできません。
これが私がこれまでに持っているものです:
$.each(theArray,function(intIndex,objValue){
$("#" + objValue.id).parent().css('background-color','red');
});
//NEED TIMING EVENT FOR DELAY
$.each(theArray,function(intIndex,objValue){
$("#" + objValue.id).parent().css('background-color','transparent');
});
最初のループは正常に動作しますが、他のループを動作させることができません。
私はこのようにしてみました:
$.each(theArray,function(intIndex,objValue){
$("#" + objValue.id).parent.css('background-color','red').delay(1000).css('background-color','transparent');
});
それも何もしませんでした。
そのため、何が問題なのかよくわかりません。助言がありますか?