Wednesday, 18 September 2013

how to access the parent tag using javascript from inside a child tag

how to access the parent tag using javascript from inside a child tag

Say I have the following code
<div id='div1'>
<div onclick="f1(parent div tag)">
hello
</div>
</div>
I think my code is clear. Here I want to access the <div> with id 'div1'
(or say the id of it if available) to send it as a parameter to the
JavaScript function f1(). How can I do It?
I am getting no reference for exactly this problem from anywhere else.
Please help me out.

No comments:

Post a Comment