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

  • SEARCH
  • Home
  • 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 8428213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:59:28+00:00 2026-06-10T04:59:28+00:00

I am using jQuery and YUI-3.6.0 in my application. I am using YUI history

  • 0

I am using jQuery and YUI-3.6.0 in my application. I am using YUI history module. I trie to create a wrapper on YUI history as below. (This is saved in “history-wrapper.js”)

var MyHistory;

(function() {
    YUI().use('history', function (Y) {
        var history = null;

        MyHistory = function() {
            history = new Y.History();
        };

        MyHistory.prototype.save= function() {
            history.add({
                data : "some data"
            });
        };

        MyHistory.prototype.load= function() {
            var data = (history.get("data");
            //process data
        };
    });
})();

I am using this wrapper with following lines of code

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="yui/yui/yui-min.js"></script>
<script type="text/javascript" src="js/history-wrapper.js"></script>
<script type="text/javascript">
    var jQ = jQuery.noConflict();

    jQ(document).ready(function() {
        var history = new MyHistory();
        history.save();
    });
</script>

I am using same code in two different application.

  • In one application, everything works fine as Wrapper is loaded first.
  • In other application it throws “MyHistory is not defined” as “jQ(document).ready” function is called before wrapper is loaded.

I have no idea what causes this behavior. Can anyone help me?

  • 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-06-10T04:59:30+00:00Added an answer on June 10, 2026 at 4:59 am

    The callback function “function(Y){… where you define MyHistory…}” in the YUI.use() is only executed when the dependendies (history) are loaded.

    Then, you have no assurance MyHistory is defined when you try to use your wrapper.

    The solution may be you put your JQuery code in the the YUI.use() too. You can make the YUI loader load jquery and the history module, you the no longer need to wrap the Histroy plugin.

    I’m not sure it is exactly like this (cannot check it now).

    <script type="text/javascript" src="yui/yui/yui-min.js"></script>
    YUI({
        modules: {
            'jquery': {
                path: 'js/jquery.js'
            }
        }
    }).use('history', 'jquery' , function (Y) {
     var jQ = Y.jQuery.noConflict(); //or juste jQuery.noConflict();
    
        jQ(document).ready(function() {  //it is likely the document will already be ready
            var history = new Y.History();
            history.save();
    
        });    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application that is using both jQuery 1.2.6 and YUI 2.6.0
When using third-party libraries such as jquery, yui-reset, swfobject and so on, do you
When I minify jquery using YUI compressor, it works fine. When I then add
I'm using a YUI datatable to create some basic client side sorting for some
I am using jquery portlets in my web application. http://jqueryui.com/demos/sortable/#portlets What I want to
I'm using the Tabs from jQuery UI in my Grails application. In the different
I am using YUI reset and jquery AutoGrow together on the same site. It
I'm diving into Require.js to build a Google Maps application using this link and
I've been using jQuery and YUI side-by-side with no issues until recently. Occasionally, inside
I need to use the YUI equivalent for the jQuery .load() function in order

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.