The main problem is, since the fields can be updated very quickly.
There could be multiple "sending. . ." tags next to input boxes. With
the fadeout, this will produce strange results if I just move it
around.

Also, I just tried the method you described and it only works the
first time.


On Apr 28, 7:27 pm, brian <bally.z...@gmail.com> wrote:
> You're not actually removing the span, though. It might be better to
> create it once, then move it wherever as needed.
>
> // inside $(document).ready()
>
> $('<span>').attr("id", "fieldstatus")
>         .addClass("fieldstatus")
>         .appendTo('body');
>
> ...
>
> // inside your event handler
> $('#fieldstatus')
>         .remove()
>         .html("sending . . .")
>         .appendTo( $(this).parent() );
>
> On Tue, Apr 28, 2009 at 10:10 PM, Code Daemon <ryan.det...@gmail.com> wrote:
>
> > I am creating an element with createElement and then appending it to a
> > table and then after a few seconds, deleting it with a call to empty
> > (). This works fine
>
> > The problem seems to be that every time I create the element, I am
> > creating it with the same id and after a few iterations, it fails. It
> > will append the element to the table, but will not fadeout or delete
> > the element properly.
>
> >                                var obj = document.createElement('span');
> >                                $(obj).attr("id", "fieldstatus")
> >                                        .addClass("fieldstatus")
> >                                        .html("sending . . .")
> >                                        .appendTo( $(this).parent() );
>
> >                                $.post('main/submit', {date: 
> > $("#caldate").val(), fieldname: $
> > (this).attr("id"), value: $(this).val() },
> >                                        function(json){
> >                                                
> > $("#fieldstatus").html(json.status);
> >                                                setTimeout(function(){
> >                                                                
> > $("#fieldstatus").fadeOut(2000, function(){
> >                                                                             
> >                            $("#fieldstatus").empty();
> >                                                                             
> >                            });
> >                                                        },
> >                                                1000);
> >                                        },
> >                                        "json"
> >                                );

Reply via email to