Hide elements that are not siblings to the clicked element.
I am trying to hide element that are not siblings to a clicked element but it doens't seem to work. The toggle aspect works perfectly. However, if click on another row, they all still open even those that not siblings to the licked element. Any ideas on how this can be achieved. My code looks like below.
- $("td i.material-icons").click(function () {
- // alert("It should be hidden");
- $(this).siblings("ul.messageNav").toggleClass("showMessageNav");
- $("ul.messageNav").not($(this).siblings("ul.messageNav")).hide();
- });