I thought it is simple but why am I not able to achieve it, I don't understand,
this is what I am doing var isidThere = $("#tabcnt"+fileid_id); if (isidThere.size() != 1){ $.get("files/"+fileid+".php",function(data){ $("#tabcnt_"+rowopen).html(data).slideDown("slow",function(){ $("#tabcnt"+fileid_id).html(data); //here I am trying to create a new element to store data for future use without having to query it again form server }); }else{ $("#tabcnt"+fileid_id).html(data); $("#tabcnt_"+rowopen).html(data).fadeIn("slow"); } }); }.... I thought this statement $("#tabcnt"+fileid_id).html(data); would create a new element in the DOM but even after going through the loop the check on top throws isidThere.size() as 0, which means the element is not there is DOM. Can someone please guide me as to why the element is not being created here to store the data. many thanks in advance for any help.