Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-24-2009, 05:08 AM   PM User | #1
mrkorg
New Coder

 
Join Date: Oct 2009
Posts: 15
Thanks: 3
Thanked 0 Times in 0 Posts
mrkorg is an unknown quantity at this point
load javascript after dom load

Hi guys,

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

Code:
      <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:
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
mrkorg is offline   Reply With Quote
Old 10-24-2009, 08:54 AM   PM User | #2
seco
Regular Coder

 
seco's Avatar
 
Join Date: Nov 2008
Location: Oregon
Posts: 682
Thanks: 5
Thanked 79 Times in 77 Posts
seco has a little shameless behaviour in the past
have you tried surrounding that with

Code:
$(document).ready(function() {
//your js
});
seco is offline   Reply With Quote
Users who have thanked seco for this post:
mrkorg (10-24-2009)
Old 10-24-2009, 10:01 AM   PM User | #3
mrkorg
New Coder

 
Join Date: Oct 2009
Posts: 15
Thanks: 3
Thanked 0 Times in 0 Posts
mrkorg is an unknown quantity at this point
thanks guys i will give it a try now....

Ill let you know waht happens
mrkorg is offline   Reply With Quote
Old 10-24-2009, 10:21 AM   PM User | #4
mrkorg
New Coder

 
Join Date: Oct 2009
Posts: 15
Thanks: 3
Thanked 0 Times in 0 Posts
mrkorg is an unknown quantity at this point
SECO YOU LEGEND!!!!!!!

Thanks mate its working perfectly

Much Appreciated....
mrkorg is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:47 AM.


Advertisement
Log in to turn off these ads.