If you try this code here:
I'm trying to find a div with id "test" and if I don't find, I create it. The problem is that if I call this function many times, it re-creates the div all the time:
var divClasses = $('#test');
if (divClasses.length==0) {
divClasses = $('<div />', { id:"test" }).appendTo('body');
console.log('anormal !');
}
How comes?