Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

referencing parent divs 1

Status
Not open for further replies.

jpadie

Technical User
Joined
Nov 24, 2003
Messages
10,094
Location
FR
i have the following approximate html

Code:
<div>
  sometextnode
  <button onclick="callsomejs(this.parent);">Press Me</button>
</div>

i am trying to provide a script with a reference to the div in which the button resides. I know i can work around this with explicit id's but that's not what i'm after.

i would have thought that the div is the button's parent here but i am getting an error that indicates that the parent is undefined. I guess that a button can only have a form as a parent.

Therefore: is there any js nomenclature that allows me to reference the div in which the button is resident?

 
oh god...

how dumb am I!

thanks,
Justin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top