Get 'this' element into a link [javascript]
Posted: Tue Oct 07, 2008 12:42 pm
I have a list item that is removed from the list when it is clicked on.
instead of using 'onclick' though, I want 'this' to be in a link:
However, the link (obviously) doesn't work. How can I make the href point to the correct element without knowing the list item index? I tried and similar things, but I'm sure I'm using that incorrectly. Any ideas?
Thanks.
Code: Select all
<li onclick="remove(this)" style="cursor: pointer;">Code: Select all
<li><a href="javascript:remove(this)">x</a></li>Code: Select all
<a href="javascript:remove(this.parentNode)">x</a>Thanks.