Hi,

I want to remove the current DOM using tagName=DIV. Below function works fine in IE but not working properly in mozilla. The 'if' part is for IE and 'else' part is for mozilla FF. In 'else' part,The current DIV is not removing, only the DIV at position 1,that is the div at the first element in the array is removed.

Kindly anybody give me solution on how to remove the current childelement in mozilla.

function removeit(e)
{

if (window.event) 
{ 
var current = window.event.srcElement;
while ( (current = current.parentElement)  && current.tagName !="DIV");
 current.parentElement.removeChild(current);
}

else
{
var current = e.target;
var element = document.getElementById("moreUploads"); // its a div 
while (element.childNodes[0])  {   
 element.removeChild(element.childNodes[0]);
 removeChildNodes(element);  }
}

}

Pradeepktg,

Use parentNode rather than parentElement . This will work in both browsers without needing to branch.

Airshow

Pradeepktg,

Use parentNode rather than parentElement . This will work in both browsers without needing to branch.

Airshow

Airshow,

Thats for your effort. I made it work in other way,ofcourse using parentNode. The posted code was bit complicated. I made it easier n it all worked fine.
Thanks,

Pradeepktg,

If "solved" then could you please mark the topic as such.

Thanks
Airshow

Pradeepktg,

If "solved" then could you please mark the topic as such.

Thanks
Airshow

Hi Airshow,

Sorry for not marking the thread as "solved". Since am a new user, i dont know how to mark this thread as solved. It would be better if you can assist me on this.
Thanks,

Pradeep,

That's a very good question. I have only ever answered questions here, not asked. Therefore never had occasion to mark solved.

It must be something available to you as original poster of a topic. I guess that when viewing the topic, there's a "Mark Solved" button/link somewhere toward top or bottom of the page. If you still can't find it then try asking a moderator (click "Currently online" at very top of page, then look for bold entry in the ""Who's Online list ....).

Another option is the "Daniweb Community Feedback" forum - you could ask there.

There must be some help pages somewhere in Daniweb but I've never found them!

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.