I'm currently facing an issue with a code snippet that I have. The requirement is for the user to be able to hover over "Div 1" and/or "Div2" and trigger a red border around both elements simultaneously. Due to the complexity of my WordPress theme, these elements cannot be nested, making it challenging to achieve this effect using simple CSS methods.
<html>
<head>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<div class="attachment-shop_catalog">Div 1</div>
<div class="title-wrapper">Div 2</div>
</body;
<script>
$(document).ready(function() {
$('.attachment-shop_catalog .title-wrapper').hover(function() {
$(this).css('border', '1px solid red');
},function() {
$(this).css('border', '0');
});
});
</script>
</html>
CSS (external stylesheet):
.attachment-shop_catalog {
background-color: grey;
border: 1px solid #000;
border-bottom: none;
padding: 10px 20px 10px 20px;
width: 80px;
}
.title-wrapper {
border: 1px solid #000;
padding: 40px 20px 40px 20px;
width: 80px;
}
Attached are images from the live site showcasing where the red border needs to appear identically on both elements simultaneously.
https://i.sstatic.net/fWAGL.png https://i.sstatic.net/luSAB.png
I would greatly appreciate any guidance or assistance in resolving this issue with the code. Thank you in advance! :)