Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: starting jQuery

  1. #1
    New to the CF scene
    Join Date
    Jul 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    starting jQuery

    I am trying to mess around with using jQuery plugins and found a nice tutorial (that I used once before several months ago). I can't get this first part to work though to make sure my document is ready. Can anyone help? I should get an alert but I don't...

    I have this inside my <head> tags in my html document but I don't get an alert.

    Much thanks in advance.

    Code:
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    
    <script>
    $( document ).ready(function() {
     
        alert("Testing jQuery");
     
    });
    
    </script>

  • #2
    Regular Coder
    Join Date
    Aug 2010
    Posts
    970
    Thanks
    19
    Thanked 212 Times in 210 Posts

  • #3
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,662
    Thanks
    6
    Thanked 1,006 Times in 979 Posts
    No, Davey, that protocol-independent URL is correct. It will choose the protocol (HTTP or HTTPS) depending on the protocol with which the page is currently served, to prevent unsafe content to be loaded in a secure environment.

    That code looks correct and should actually work. What is the error console saying? Can you give us a link? Try to add the missing type attribute to the script element.

    Also, instead of “document ready” you can and should use the shortcut:
    Code:
    $(function() {
      // your code here
    });

  • #4
    Regular Coder
    Join Date
    Aug 2010
    Posts
    970
    Thanks
    19
    Thanked 212 Times in 210 Posts
    Quote Originally Posted by VIPStephan View Post
    No, Davey, that protocol-independent URL is correct. It will choose the protocol (HTTP or HTTPS) depending on the protocol with which the page is currently served, to prevent unsafe content to be loaded in a secure environment.
    if run from desktop
    the protocol is file system
    so it fails


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •