[jQuery] Simple problem with createElement
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"
);