Recently, I've been attempting to update the style of an element in my script, but only on a specific page. My strategy involved checking for a unique id (profile-advanced-details
) and then adjusting the height of another id (page-body
) to 1500px if found.
Despite implementing this code, it doesn't seem to be effective. Are there any syntax errors present? Is there perhaps a more efficient method to achieve this desired outcome?
var wrap = document.getElementById("page-body");
if (!document.getElementsById('profile-advanced-details').length){
return; // Do nothing if profile-advanced-details doesn't exist
}
else {
wrap.style.height = "1500px"; // Change the height of page-body if it does exist
}
Any insights or guidance would be greatly appreciated!