homepage Welcome to WebmasterWorld Guest from 54.161.185.244
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
IE 7/8 Issue - Unable to get value of the property 'id': object is nul
currentTarget IE 7/8 issues with AJAX form
frankstuner



 
Msg#: 4393265 posted 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="";
}
}

 

penders

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



 
Msg#: 4393265 posted 1:04 pm on Dec 2, 2011 (gmt 0)

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

frankstuner



 
Msg#: 4393265 posted 1:12 pm on Dec 2, 2011 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved