Thanx for the fast reply! I just now found why it was not working.. With this it works: <a onclick="removeItem('something', this.parentNode);">click</a>
with this not (will give the freaking error): <a href="javascript:removeItem('something', this.parentNode);">click</a> Now why is this not working with a href? I have just no clue. On Fri, Jun 20, 2008 at 1:08 AM, Josh Nathanson <[EMAIL PROTECTED]> wrote: > > Your function is fine, however when you *call* the function removeItem, > you'll need to pass in two arguments -- otherwise obj will be undefined: > > removeItem('myitem'); // obj is undefined > removeItem('myitem', myobject); // obj is defined > > -- Josh > > > ----- Original Message ----- From: "Mark" <[EMAIL PROTECTED]> > To: <jquery-en@googlegroups.com> > Sent: Thursday, June 19, 2008 4:02 PM > Subject: [jQuery] Why do i keep getting: test is not defined! > > >> >> hey, >> >> function removeItem(name, obj) >> { >> var answer = confirm("Are you sure you want to delete: " + name + "?") >> var test = obj; >> >> if (answer) >> { >> $(test.parentNode.parentNode).fadeOut("slow"); >> } >> } >> >> the code is simple and still not working.. the issue is that i try to >> call a variable in a if that wasn't made there.. but how can i resolve >> that? >> Why is javascript not working how you would expect it to work :S i >> know Java and PHP well and things like this are no issue in them. >> >> o and in this code i already put obj in test.. i've tried it with obj >> first but that gave the same error as in the title. >> >> Thanx. > >