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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    need help with Microsoft JScript runtime error: '$' is undefined

    I get "Microsoft JScript runtime error: '$' is undefined" with the javascript below. How should I troubleshoot this?

    <script type="text/javascript" language="javascript">
    function ShowPopup() {
    $('#mask').show();
    $('#<%=pnlpopup.ClientID %>').show();
    }
    function HidePopup() {
    $('#mask').hide();
    $('#<%=pnlpopup.ClientID %>').hide();
    }
    $(".btnClose").live('click', function () {
    HidePopup();
    });
    </script>

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,206
    Thanks
    80
    Thanked 4,571 Times in 4,535 Posts
    That means you haven't loaded the jQuery library.

    You should have a line that looks like
    Code:
    <script src="...some...url...that...ends...with....jquery.js"></script>
    in your page.

    $ is simply a variable name (yes, JS variables can use $ and can start with $) that jQuery [and a few other libraries, but the odds or 50 to 1 it's jQuery] uses as its universal "find anything anwhere" function name.

    For example, $("#mask") means essentially the same thing as document.getElementById("mask")
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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