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

         

frankstuner

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

10+ Year Member



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="";
}
}

penders

1:04 pm on Dec 2, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



currentTarget is not supported by IE6-8. Perhaps use 'target' or click events?

frankstuner

1:12 pm on Dec 2, 2011 (gmt 0)

10+ Year Member



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