Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7643081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:21:23+00:00 2026-05-31T09:21:23+00:00

All, I’ve got the following code: $(document).ready(function() { // more code using $ as

  • 0

All,
I’ve got the following code:

$(document).ready(function() {
// more code using $ as alias to jQuery
alert('it works');
},'jQuery');

When the page loads I get the following error:

Uncaught TypeError: Property '$' of object [object DOMWindow] is not a function

I’ve loaded jQuery before I tried to add this.

Here is how this was loaded (my code is the custom.js):

<script type='text/javascript' src='http://localhost/oml_live_update/wp-includes/js/jquery/jquery.js?ver=1.7.1'></script>
<script type='text/javascript' src='http://localhost/oml_live_update/wp-content/themes/alyeska/framework/frontend/assets/plugins/prettyphoto/js/jquery.prettyPhoto.js?ver=3.1.3'></script>
<script type='text/javascript' src='http://localhost/oml_live_update/wp-content/themes/alyeska/framework/frontend/assets/js/superfish.js?ver=1.4.8'></script>
<script type='text/javascript' src='http://localhost/oml_live_update/wp-content/themes/alyeska/framework/frontend/assets/js/flexslider.js?ver=1.8'></script>
<script type='text/javascript' src='http://localhost/oml_live_update/wp-content/themes/alyeska/framework/frontend/assets/js/roundabout.js?ver=1.1'></script>
<script type='text/javascript' src='http://localhost/oml_live_update/wp-content/themes/alyeska/assets/js/alyeska.min.js?ver=1.0'></script>
<script type='text/javascript' src='http://localhost/oml_live_update/wp-content/themes/alyeska/assets/js/custom.js?ver=1.0'></script>

Any ideas on why this won’t work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:21:25+00:00Added an answer on May 31, 2026 at 9:21 am
    $(function() {
        alert('it works');
    });
    

    Does that not work for you? This is a standard syntax for this: http://api.jquery.com/ready/

    If you want to create an IIFE (immediately invoked function expression):

    (function ($) {
        alert('it works');
    })(jQuery);
    

    This creates a new scope for the code within and passes in the jQuery object as $.

    Update

    I don’t use WordPress but my understanding is that $j=jQuery.noConflict(); is run, so jQuery is basically stored in the $j variable (if it isn’t done automatically then it needs to be done manually):

    <script type='text/javascript' src='http://localhost/oml_live_update/wp-includes/js/jquery/jquery.js?ver=1.7.1'></script>
    <script>
    $j = jQuery.noConflict();
    $j(function () {
        alert('it works');
    });
    </script>
    ...
    

    Also note that you can pass $ into the anonymous function that is the document.ready event handler so you don’t have to use $j:

    $j(function ($) {
        alert('it works');
        //you can now use $() instead of $j()
    });
    

    Update

    Have you tried using jQuery in place of $?

    jQuery(function($) {
        alert('it works');
        //since `$` was passed into this function, it can be used instead of `jQuery`
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All, Say I have the following bit of code: select: function(start, end, allDay) {
all I want to show hide some ids using jQuery. My html code is
All, See the code below: function menu() { this.menuitem=[]; this.submenu=[]; this.menuitem[0] = $('div#sivname1'); this.menuitem[1]
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
All, I have the following code: $fetch = mysql_query(SELECT * FROM calendar_events where event_status='booked'
all I want to calculate the height of the page ,and in my test.less
All, I am building a small site using PHP. In the site, I receive
All, I'm using wordpress with this and for some reason the eventDrop stopped working.
All, I'm using Facebook Connect (JS SDK) to authenticate a user to my site.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.