Reputation: 1213
I am facing an issue because of removeChild method in javascript.
I am using below code to remove a div tag.
this.parent.parent.removeChild(this.parent).
that code is working pretty fine in FF but it give me error in IE7/8.
" Error: Object doesn't support this property or method ".
is removeChild method is not supported in IE7/8 or is there any other alternate of this method?
Regards,
Mahendra Athneria
Mumbai,Maharashtra,India
Upvotes: 0
Views: 2871
Reputation: 1213
thanks for your precious time and reply. special thanks to Meder.
Finally i found the solution.
Here is my solution and analysis.
actually in my code i was using this.parent.parent.removeChild(this.parent) to delete the child. this.parent return [object window] and [object window] does not support the removeChild property. to use removeChild method we need the Element and to get the element i made some change in my code.
1st - change the method signature.
function removeCriteria(thisObj) {.....}
2nd -only for IE
thisObj.srcElement.parentElement.parentElement.removeChild(thisObj.srcElement.parentElement);
this solution works for me and hope my analysis is right :-)
For @Meder & other seniors - correct me if i am wrong.
Regards,
Mahendra
Mumbai,Maharashtra,India
Upvotes: 0