Welcome to WebmasterWorld Guest from 54.145.166.96

Forum Moderators: open

Message Too Old, No Replies

IE 7/8 Issue - Unable to get value of the property 'id': object is nul

currentTarget IE 7/8 issues with AJAX form

   
4:07 am on Dec 2, 2011 (gmt 0)



I've made an ajax search form that brings up results onkeyup, that works well.

To remove the results if someone clicks anywhere on the page outside the results list i've used currentTarget on a transparent fullscreen div at the top of the page to clear the results.

It works perfectly in ff, ie9, chrome, safari & opera. But when trying it in ie 7 and ie 8 it shows the results but won't remove them. The console is returning this:

SCRIPT5007: Unable to get value of the property 'id': object is null or undefined

Any ideas what this could be. I've search for bugs online but it didn't bring anything I could work out.


function searchRemove(event)
{
var x=event.currentTarget;
if(x.id!="search")
{
document.getElementById("close-result").innerHTML="";
document.getElementById("search-results").innerHTML="";
}
}
1:04 pm on Dec 2, 2011 (gmt 0)

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



currentTarget is not supported by IE6-8. Perhaps use 'target' or click events?
1:12 pm on Dec 2, 2011 (gmt 0)



Thanks for that, I've ended up reworking it with some onclick events.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month