javscript loading before dom load

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
mrkorg
Forum Newbie
Posts: 3
Joined: Mon Oct 12, 2009 9:41 pm

javscript loading before dom load

Post by mrkorg »

Hi guys,

I am trying to insert the following call into my page;

Code: Select all

     <script type="text/javascript" defer="true">
$('#query').autocomplete({
    serviceUrl:'service/autocomplete.ashx',
    minChars:1,
    delimiter: /(,|;)\s*/, // regex or character
    maxHeight:400,
    width:250,
    deferRequestBy: 0, //miliseconds
    params: { country:'Yes' }, //aditional parameters
    // local autosugest options:
    lookup: ['January', 'February', 'March', 'April', 'May'] //local lookup values
  });
</script>

It works fine in all browsers except ie(6,7,8)

Code: Select all

Internet Explorer can not open website. Operation Aborted.
I understand it is caused by the jquery autocomplete function loading before the page / DOM has fully loaded.

I tried adding Defer="true" to the script however this doesn't seem to work.

Could someone please tell me what i must add to the script so that it loads after the dom has fully loaded?

Thanks guys

George
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: javscript loading before dom load

Post by josh »

Post Reply