How to select previous sibling via jQuery?
Select previous sibling via jQuery
558
29-Jul-2021
Aryan Kumar
27-Nov-2023In jQuery, you can use the .prev() method to select the immediately preceding sibling of an element. Here's an example:
In this example:
Make sure to include the jQuery library in your HTML file for this to work. You can adjust the selector and styling based on your specific use case.