i have the following approximate html
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?
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?