Skip to content Skip to sidebar Skip to footer

Javascript Won't Work Unless I Use Alert()!

I run into this issue from time to time and I don't know how to solve it. Here's my code that fails: function on_lightbox_open() { system.contextBrowserInit(); updateUrl(

Solution 1:

Perhaps your use of .live() requires a fully loaded document and the alert just buys the browser some extra time. Try surrounding with $(document).ready();

Source: jQuery-driven app. won't work without alert()

Solution 2:

Instead of:

<script>
    system.contextBrowserInit();
    //etc</script>

Try this (HTML doctype):

<scriptdefer>
    system.contextBrowserInit();
    //etc</script>

Correct syntax for XHTML doctype is

<scriptdefer="defer">
    system.contextBrowserInit();
    //etc</script>

Post a Comment for "Javascript Won't Work Unless I Use Alert()!"