Skip to content Skip to sidebar Skip to footer

How Do I Get The Parent Of An Element?

I am trying to make a function in PHP that is like JavaScript's alert() command, but when I click the OK button on one alert, all of the alerts disappear! Here is my code:

Solution 1:

Using plain javascript with parentNode:

element.parentNode

In jQuery:

element.parent()

Solution 2:

Use this.parentNode to get the parent.

Post a Comment for "How Do I Get The Parent Of An Element?"