Monday, July 8, 2013

Load jQuery UI with requireJS

RequireJS is one popular script loading framework out on the web. At the same time, most of the web applications and websites are now using jQuery and there are quiet a lot of them that use jQuery UI as well. You may know that jQuery UI is dependent on jQuery, meaning that in order for jQuery UI to load correctly, jQuery should be loaded first.

In older version of RequireJS, it was a lot more harder (and ugglier you may say) to include jQuery UI since the jQuery UI library (unlike jQuery) is not following an  Asynchronous Module Definition  (AMD) style. Then you need to include AMD-enabled scripts which were built within communities and especially James Burke. However, in the last versions of RequireJS, a lot of features were added regarding this.

Remark: If you are not familiar with Asynchronous Module Definition (AMD) and interested to know more, read this article Why AMD?

So let's get on with it. I presume that you are following a folder structure like this:




Here is how you minimal index.html file should look like:


    sample_app
    




One of the scripts that handles a lot of key information is the one attributed with data-main (i.e. main which stands for main.js). In this script you can define your library paths and a tag called shim which handles dependencies and non-AMD module loading. After that there is the code on how application will continue its initialisation process. This looks something like:


require.config({
    paths: {
        "jQuery": "../libs/jQuery//jquery-1.9.1",
        "jQueryUI": "../libs/jQueryUI/jquery-ui-1.10.3.custom"
    },
    shim: {
        "jQueryUI": {
            export:"$" ,
            deps: ['jQuery']
        }
    }
});

require(["app"], function(App)
{
    App.initialize();
});

As you can see with the paths you are declaring a key-value pair of library conventions and paths and with shim, you are flagging the non-AMD modules which in this case is also dependes on jQuery. In the last step, add the following to your app.js file:

define(["jQuery", "jQueryUI", "guiFunctions"], function ()
{
   var initialize = function ()
   {
      //jQuery, jQuery UI are added here now ...
   };
  
   return {
      initialize : initialize
   };
});
And that is it!

101 comments:

  1. Croma campus is best IT training institute and best class IT trainer provides croma campus is great jquery training in noida wiht jo b placement support. croma campus best facilities and lab provides then best option for you join us croma campus

    ReplyDelete

  2. As we heared more and more tips which enable us for writing for the content. But with this especially how the authoritative really nice. I agree with your 3 point include with more images and codings. It will enable the readers without any confused or any other thing and finally cleared with what we are going to school signs uktell.official website

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Nice post. By reading your blog, i get inspired and this provides some useful information. Thank you for posting this exclusive post for our vision..... Best software Training institute in Bangalore

    ReplyDelete
  6. Thanks for sharing this valuable information and we collected some information from this blog.
    Machine Learning Training in Gurgaon

    ReplyDelete
  7. Thank you for sharing such great information very useful to us.
    hire dedicated developers

    ReplyDelete
  8. Excellent blog I visit this blog it's really awesome. The important thing is that in this blog content written clearly and understandable. The content of information is very informative.
    Oracle Fusion Financials Online Training
    Oracle Fusion HCM Online Training
    Oracle Fusion SCM Online Training

    ReplyDelete
  9. Here we are offering some diiferent courses and cloud computing is one of them . So come and join this course and make your carrer bright. For more Information just click on the mentioned link anf get the other details of the course.
    Cloud Computing Course in Delhi

    ReplyDelete
  10. Nice article, interesting to read…
    Thanks for sharing the useful information
    pega certification

    ReplyDelete
  11. Thanks For Sharing this Post.
    Interested In Python!!
    Click here for the Best Python Training Institute in Gurgaon
    https://www.acil.in/python-training-in-gurgaon/

    ReplyDelete
  12. Hey Nice Blog!! Thanks For Sharing!!! Wonderful blog & good post. It is really very helpful to me, waiting for a more new post. Keep Blogging

    amazon web services tutorial for beginners

    ReplyDelete
  13. Join tally training institute in Delhi,Noida and become an expert in few days. We are providing best training for tally course in noida and Delhi.Our institute leads in providing 96% placement to the students. We organize 100% live project, classroom training, development classes,presentation etc to perform well in future.Our trainers hold 10years of experience in the corporate industry. Our trainers are well qualified and experienced.We conduct classes in small and large batches. we provides classes on weekend and weekdays both.Choose the slot as per your convenience. call us at 9311002620 visit https://www.htsindia.com/Courses/Tally/e-accounting-training-course

    ReplyDelete


  14. I am really happy to say it’s an interesting post to read . I learn new information from your article , you are doing a great job . Keep it up and a i also want to share some information regarding selenium online course and selenium videos

    ReplyDelete
  15. After reading your article I was amazed. I know that you explain it very well. And I hope that other readers will also experience how I feel after reading your article.
    artificial intelligence course in mumbai

    machine learning courses in mumbai

    ReplyDelete

  16. I finally found great post here.I will get back here. I just added your blog to my bookmark sites. thanks.Quality posts is the crucial to invite the visitors to visit the web page, that's what this web page is providing.
    ExcelR Data Science training in Mumbai
    ExcelR data analytics courses in Mumbai
    data science interview questions
    ExcelR Business Analytics courses in Mumbai

    ReplyDelete
  17. I finally found great post here.I will get back here. I just added your blog to my bookmark sites. thanks.Quality posts is the crucial to invite the visitors to visit the web page, that's what this web page is providing.
    ExcelR Data Science course in Mumbai
    ExcelR Courses in data Analytics
    data science interview questions
    ExcelR Business Analytics courses in Mumbai

    ReplyDelete

  18. Whatever we gathered information from the blogs, we should implement that in practically then only we can understand that exact thing clearly, but it’s no need to do it, because you have explained the concepts very well. It was crystal clear, keep sharing.... python data science tutorial

    ReplyDelete
  19. Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include. Satta king

    ReplyDelete
  20. Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
    blockchain online training

    ReplyDelete

  21. Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
    microservices online training
    best microservices online training
    top microservices online training


    ReplyDelete
  22. Study ExcelR PMP Certification where you get a great experience and better knowledge.

    PMP Certification

    We are located at :

    Location 1:
    ExcelR - Data Science, Data Analytics Course Training in Bangalore
    49, 1st Cross, 27th Main BTM Layout stage 1 Behind Tata Motors Bengaluru, Karnataka 560068
    Phone: 096321 56744
    Hours: Sunday - Saturday 7AM - 11PM

    Google Map link : PMP Certification

    ReplyDelete
  23. Nice post. By reading your blog, i get inspired and this provides some useful information. Thank you for posting this exclusive post for our vision. 
    Digital Marketing Online Course
    AWS Online Course
    Python Online Course
    Selenium Online Course
    Data Science Online Course
    DevOps Online Course

    ReplyDelete
  24. Really very nice blog information for this one and more technical skills are improve,i like that kind of post. oracle training in chennai

    ReplyDelete
  25. It's a really great and useful piece of information. Thanks, and please keep up the rewarding work. Beth Dutton Coat

    ReplyDelete
  26. Great information about wilderness for beginners giving the opportunity for new people.
    beth dutton coat

    ReplyDelete
  27. very well explained. I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
    Logistic Regression explained
    Correlation vs Covariance
    Simple Linear Regression
    data science interview questions
    KNN Algorithm
    Bag of Words Python

    ReplyDelete
  28. This comment has been removed by the author.

    ReplyDelete
  29. I was taking a gander at some of your posts on this site and I consider this site is truly informational! Keep setting up..
    토토사이트

    ReplyDelete
  30. I am genuinely thankful to the holder of this web page who has shared this wonderful paragraph at at this place

    Click Now
    Click Now
    Click Now
    Click Now
    Click Now
    Click Now
    Click Now
    Click Now
    Click Now
    Click Now

    ReplyDelete
  31. Nice post. By reading your blog, i get inspired and this provides some useful information. Thank you for posting this exclusive post.

    Advance Digital Marketing Training in Gurgaon

    ReplyDelete
  32. Thanks for the interesting content. I like your post and your blog is amazing.
    If you are interested in Video Downloader apps you can check my blog site. It is new and really informative.

    filmywap 2015 hd movies download

    ReplyDelete
  33. Thanks for sharing this amazing post this is the content i really looking for, it's very helpful i hope you will continue your blogging anyway if anyone looking for AutoCAD training institute in delhi contact us +91-9311002620 visit-https://www.htsindia.com/Courses/business-analytics/adv-excel-training-course

    ReplyDelete
  34. If Oracle is your dream job, then we, Infycle, are with you to make your dream into reality. Infycle Technologies offers the best Oracle Training in Chennai, which offers various programs in Oracle such as Oracle PLSQL, Oracle DBA, etc., in the 200% hands-on practical training with specialized trainers in the field. Also, the mock interviews will be arranged for the candidates to face the interviews without any fear, and 100% placement assurance will be given here. To have the words above real, call 7502633633 to Infycle Technologies and grab a free demo to know more.Best Oracle Training in Chennai | Infycle Technologies

    ReplyDelete
  35. Thats great post !! I like ur every post they always give me some new knowledge.

    VidMate | VidMate for PC |
    VidMate 2014

    ReplyDelete
  36. If you want to get professional data analysis training so join with us for Further More Information About Python training institute in Delhi Contact Here-+91-9311002620 Or Visit Website- https://www.htsindia.com/Courses/python/python-training-institute-in-south-delhi

    ReplyDelete
  37. provides the quality service of customized fiber connections in the case of large businesses and government entities. Skyfall Leather Jacket

    ReplyDelete
  38. Thanks for the blog but If your looking to switch your career to the airline industry we the Fusion is the best place to pursue. It provides one of the Air Hostess Training Institute

    ReplyDelete
  39. I read this article. I think you have worked very hard to create this article. I like your work.satta king

    ReplyDelete
  40. Impressive!Thanks for the post.This is the article that might be a great help for you where you can learn about the spacebar counter test where when you start clicking your spacebar, the spacebar counter test automatically. So if you want to learn more please visit. Thank you.

    ReplyDelete
  41. Renting a car is usually a less-than-exciting experience when traveling. Getting the keys to a bland four door is nothing to write home about. What many do not realize is that any vacation or business trip can be an adventure with a car hire. Luxury Car Rental Coimbatore

    No matter the destination, having the keys to an exotic car is a thrill. Even the gas station can be fun when fellow customers notice the beauty at the pump. A car that totals more than many people's mortgage is sure to turn heads wherever it goes. Just the sound of the engine will catch the attention of admirers as you fly by.

    Self drive car Bangalore

    ReplyDelete
  42. BLCK Luxury - Bangalore | Luxury Car Rental Bangalore | Luxury Taxi Bangalore | Self Drive Cars in Bangalore

    Luxury Car Rental Bangalore

    ReplyDelete
  43. Thanks for sharing a nice explained blog like Load jQuery UI with requireJS.

    ReplyDelete
  44. WhyDonate is één van de populairste crowdfunding platforms van alle Europese landen en de Verenigde Staten
    WhyDonate is niet alleen geschikt voor het opzetten van fondsenwervende campagnes, maar bevat ook vele actieve fondsenwervers waaraan men kan doneren.
    Top 10 crowdfunding platforms in België

    https://whydonate.com/blog/crowdfunding-platforms-in-belgie/

    ReplyDelete
  45. It is so nice article thank you for sharing this valuable content. Please visit:- https://www.janbasktraining.com/aws-training

    ReplyDelete
  46. The blog post provides clear and concise steps for loading jQuery UI with RequireJS . Thanks for valuable guide.
    Digital Marketing Courses in Italy

    ReplyDelete
  47. This blog is fantastic, and I'm looking forward to your future posts. It would be great to see a deep dive into some of the real-world scenarios that might come up in the AWS Certified Solutions Architect exams. Please visit our website:- aws architect certification

    ReplyDelete
  48. Thank you for sharing fantastic tutorial on how to Load jQuery UI with requireJS.
    Investment banking training Programs

    ReplyDelete
  49. This post serves as a valuable resource for both beginners and seasoned professionals in the field. Your dedication to clarity and detail is truly appreciated.
    Data analytics framework

    ReplyDelete
  50. Where can I find the best Delhi Satta Bajar charts? I prefer checking out delhi satta matka for detailed insights.

    ReplyDelete
  51. Awesome topic! Integrating jQuery UI with RequireJS can greatly enhance modularity in your projects. Your insights on this will surely help developers streamline their workflows. Keep sharing your knowledge!
    Data Science Courses in Singapore





    ReplyDelete
  52. "Great read! The data science courses in Faridabad are a fantastic opportunity to learn."

    ReplyDelete
  53. This is such an engaging read! I appreciate how you simplified complex ideas. Great job!

    Data science courses in Gujarat

    ReplyDelete

  54. This blog offers a clear and practical guide on loading jQuery UI with RequireJS, making it incredibly useful for developers. The step-by-step instructions are easy to follow, and the explanations are concise yet informative. It's a great resource for anyone looking to optimize their JavaScript workflow. Kudos to the author for sharing such valuable insights

    data analytics courses in dubai

    ReplyDelete
  55. Loved reading your article. The opening sentence by Einstein made me want to read more. It was indeed well explained by you...am sure a child would also understand. Found the scripts very useful. Thank you for sharing.
    Data science courses in Kochi

    ReplyDelete
  56. Great article! Loading jQuery UI with RequireJS can really streamline the way we manage dependencies in our projects. I love how you broke down the steps—especially the configuration tips. Have you encountered any challenges with versioning or module conflicts when integrating jQuery UI this way? It would be interesting to hear your thoughts!
    Online Data Science Course

    ReplyDelete
  57. "Thank you for highlighting the Data Science Course in Dadar!
    The course content looks engaging and relevant to today's job market.
    I’m especially intrigued by the opportunity to work on real data sets.
    Having local courses makes learning more accessible.
    I’m definitely considering enrolling soon!"

    ReplyDelete
  58. This article provides a fantastic overview of integrating jQuery UI with RequireJS, especially considering the complexities of handling dependencies in older versions. It's great to see how RequireJS has evolved to support a smoother process for loading non-AMD modules like jQuery UI. The clear example of the require.config setup and the use of the shim configuration to handle dependencies is particularly helpful for those who might be new to this approach.
    Data science courses in Mysore

    ReplyDelete
  59. Great post! The step-by-step guide on integrating jQuery UI with RequireJS is very clear and helpful. I especially appreciate the tips on managing dependencies and ensuring that the modules load correctly.thank you for sharing your insight.
    Data science course in Bangalore

    ReplyDelete
  60. Thank you for this great tutorial on loading jQuery UI with RequireJS! Your clear and concise instructions make it easy to understand the integration process. This post is a valuable resource for developers looking to optimize their web applications. Keep up the great work!
    Data science courses in Bangladesh

    ReplyDelete
  61. This post provides a clear and concise guide on integrating jQuery UI with RequireJS, making it much easier for developers to load and manage dependencies. Great resource for anyone working with modular JavaScript applications! Investment Banking Course

    ReplyDelete