If what you are trying to do is execute $('#home').hide();only if the object is #item1present, then you will do this:
if ($("#item1").length > 0) {
$('#home').hide();
}
There is no need to check if #item1in body, as this is the only place where this is possible. You can simply simply check #item1, as identifiers must be unique.
JS , :
if (document.getElementById("item1")) {
$('#home').hide();
}
, , , .