...

View Full Version : load javascript after dom load



mrkorg
10-24-2009, 06:08 AM
Hi guys,

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


<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)
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

seco
10-24-2009, 09:54 AM
have you tried surrounding that with



$(document).ready(function() {
//your js
});

mrkorg
10-24-2009, 11:01 AM
thanks guys i will give it a try now....

Ill let you know waht happens

mrkorg
10-24-2009, 11:21 AM
SECO YOU LEGEND!!!!!!!

Thanks mate its working perfectly

Much Appreciated....



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum