To find the parent element of an element, parent()
method can be used.
<script>
$("ul").parent().css("border", "2px dashed green ");
</script>
Above code snippet will find the parent element of the “ul” element (In my case “ul” is kept under “div”, so it will apply the border css style width as 2px, border style as dotted and color as green).
Views: 5296 | Post Order: 48