I'd like to use a context menu which triggers an inline-WYSIWYG editor for a specific div. http://www.webdeveloper.com/forum/im...rderedlist.gif
This means I right-click on the div, a context menu appears and when I hit "edit", the editor triggers for that div.
The problem is that I need the ID of that div. If I use a context menu and say
Code:
onclick="toggleArea(this.id)"
then the "this.id" part wont be the ID of the div.
the keyword this will return the reference of the object whose function/method is applied on. The above example: the reference of the LI element, obviously, not of the UL element (the parent node) as it looks like you need.
I can't say in advance how many divs there will be because the whole website is created dynamically, that's why I need to find a way to read the right <div> when using the context menu there.
Last edited by znero; 11-16-2009 at 09:05 AM.
Reason: made it more clear
No Sir, you have not understood me. How many parents are between your LI element (where you have the onclick event) and the container DIV? Please, post the whole DOM structure, starting from that DIV to that LI element. It is important to see all the branches of that tree.
<body class="twoColHybRtHdr"><!-- The context menu--><ul id="CM1" class="SimpleContextMenu"><li onclick="toggleArea(this.parentNode.id);">Edit</li><li><a href="#">Item 2</a></li><li><a href="#">Item 3</a></li><li><a href="#">Close Menu</a></li></ul><!-- End of context menu --><!-- Start of "container" div --><div id="container"><!-- Start main content area --><div id="mainContent"><!-- Start First Column --><div id="firstColumn"><!-- Start spry repeat region --><div class = "container" spry:region="pv1" spry:repeatchildren="pv1" ><!-- Start text and picture div --><div id="{pv1::order/@nr}"></div><!--End text and picture div --></div><!-- End spry repeat region --></div><!-- End of first Column --><!-- Start of second column --><div id="secondColumn"><!-- Start spry repeating region --><div class = "container" spry:region="pv1" spry:repeatchildren="pv1" ><!-- Start text and picture div --><div id="{pv1::order/@nr}"></div><!-- End text and picture div --></div><!-- end spry repeating section --></div><!-- End of second column --></div><!-- End of main content area --></div><!-- End of "container" div --></body>
Bookmarks