document.body.appendChild (a); document.body.appendChild (b); // check if the dimensions of the elements are similar var available = true; if (a.offsetWidth === b.offsetWidth && a.offsetHeight === b.offsetHeight) { available = false; }