Tech Junkie Blog - Real World Tutorials, Happy Coding!: End-to-End ASP.NET MVC : Add JQuery Library Using NuGet

Saturday, June 18, 2016

End-to-End ASP.NET MVC : Add JQuery Library Using NuGet

In the previous blog we've created an empty ASP.NET MVC  project.  It's a great starting point but, it's missing a lot things that we will need later.  In this blog we will add JQuery to the empty ASP.NET MVC  project that we've just created.

Step-By-Step Instructions:

1. Open the empty ASP.NET MVC project that you've just created

2.  Right click on the the "References" node in the "Solution Explorer", then select "Manage NuGet Packages"





3. In the search box on the right of NuGet window type "JQuery", the search result will be displayed, you will see that an old version is installed for the project.  Click on the "Update" button to update to the latest version as of this post which is 3.3.1.















4. Click on the "OK" button on the "Preview Changes" dialog
















5. Now the latest version of jQuery is installed


6.  Now you should see the JQuery scripts in the "Scripts" folder


7.  To use the JQuery .js script reference the jquery-3.3.1.min.js file with the following code between the <head> element
<script src="~/Scripts/jquery-3.3.1.min.js"></script>

8. You can use the following code to test if JQuery is working in your ASP.NET MVC project
    <script>
    $(document).ready(alert("jquery is working"));
    </script>

9. So you can modify the "Index.cshtml" to have the following markup to test if JQuery is working or not, if JQuery is working you should get an alert box saying "jquery is working"
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
    <script src="~/Scripts/jquery-3.3.1.min.js"></script>
</head>
<body>
    <div>
        Hello World! 
    </div>
    <script>
    $(document).ready(alert("jquery is working"));
    </script>

</body>
</html>



Similar Posts:


57 comments:

  1. Its recommended that we use Bower Config to for client side dependencies

    ReplyDelete
  2. Thank you for the tutorial, so far works as expected

    ReplyDelete
  3. before running application ,please match the name of the file in script folder with the name in tagging you have added on cshtml view

    ReplyDelete
  4. This is not what I was looking for, but it helped thanks.

    ReplyDelete
  5. I'm not 100% sure but I think you should create bundles in "BundleConfig.cs" and then initialize them in your "_layout.cshtml".


    //create jquery bundle from files that are located in ~/scripts/ and start with jquery-
    bundles.Add(new ScriptBundle("~/bundles/jquery")
    .Include("~/Scripts/jquery-{version}.js"));

    //and then initialize the bundle at the bottom of your layout
    @Scripts.Render("~/bundles/jquery")

    ReplyDelete
  6. Thanks for the valuable information and insights you have so provided here... ring camera

    ReplyDelete
  7. composed language in the third thousand years BC. C. In any case, the distinctions in working strategies Cooperate Identity design

    ReplyDelete
  8. Your blogs are easily accessible and quite enlightening so keep doing the amazing work guys. Shock Wave Therapy

    ReplyDelete
  9. I would like to say that this blog really convinced me to do it! Thanks, very good post. youtube views

    ReplyDelete
  10. I feel extremely cheerful to have seen your site page and anticipate such a large number of all the more engaging circumstances perusing here. Much appreciated yet again for every one of the points of interest. ClassyPrice

    ReplyDelete
  11. I have perused your article, it is exceptionally enlightening and helpful for me.I respect the profitable information you offer in your articles. Thanks for posting it. Phone Price in Bangladesh

    ReplyDelete
  12. If closely examined, one code is for vascular and the other, nonvascular. New coders, however, may focus on the term not elsewhere classified and miss the important distinction between the two codes.ergonomic chair for back pain

    ReplyDelete
  13. Well, that’s the first time on your blog but I really like your post.

    I have my own blog where I post about E Scooter App Development and much more take a look.

    ReplyDelete
  14. Experience With My Roommates Girl friend
    Hi friends, I am Maxx not real name 24, with an athletic body type college sex video . I am a new reader of this site. I like many stories published in it. Today I want to share one of my sexual experiences which I enjoyed very much. It all started 4 months ago in Kolkata when I changed my job from Hyderabad to Kolkata. This is a very common thing in a BPO sector in the day of induction I met a cool guy Sunny, before long we became good friends.

    ReplyDelete
  15. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often. situs judi online

    ReplyDelete
  16. I have perused your article, it is exceptionally enlightening and helpful for me.I respect the profitable information you offer in your articles. Thanks for posting it. Mobile Phone Price in Bangladesh

    ReplyDelete
  17. Discover the world of iphone 6 charger. Compare models, find more iPhone 6 power and iPhone 6 cable accessories and shop online.

    ReplyDelete
  18. It is safe to say that you are looking for the best touchscreen laptop under 300 in 2020? The correct method to buy tablets is through the online sites. There are various sites that include enormous measure of biggest screen tablets.

    ReplyDelete
  19. With the slide scanner, you can still have your old photos restored as long as you have the negatives. BEST SLIDE SCANNERS REVIEWS

    ReplyDelete
  20. Great Article, you describe End-to-End ASP.NET MVC in very well way. I really enjoyed exploring your site Good Luck.

    ReplyDelete
  21. Technology Business We welcome unsolicited news articles, analysis pieces, and op-eds. If you want to write for us, then send your articles to globeobservers@gmail.com. Your articles should be exclusive to us.

    ReplyDelete
  22. visite our site for more information
    Techia

    ReplyDelete
  23. This article is a connecting with wealth of accommodating educational that is intriguing and exquisitely formed. I perceive your troublesome work on this and thank you for this information. I know it very well that if anyone visits your blog, by then he/she will undeniably come back to it.



    switches


    ReplyDelete
  24. Thank You Sir, I try that tutorial and successfully added JQuery Library. I hope that you will give us another tutorial JQuery Library Using NuGet. Also see New Mobile Phone Price in Bangladesh, It is exceptionally enlightening and helpful for me.

    ReplyDelete
  25. Next time I read a blog, Hopefully it does not fail me just as much as this one. After all, I know it was my choice to read, however I actually believed you would probably have something useful to talk about. All I hear is a bunch of complaining about something you could possibly fix if you weren't too busy searching for attention.disinfecting san antonio

    ReplyDelete
  26. Nice post. I learn something new and challenging on sites I stumbleupon on a daily basis. It will always be exciting to read through articles from other writers and use something from their web sites.
    cryptocurrency

    ReplyDelete
  27. Great post but I was wondering if you could write a little more on this subject? I’d be very thankful if you could elaborate a little bit further. Thanks in advance! https://enisxytiswifi.com/

    ReplyDelete
  28. I must thank you for the efforts you've put in penning this blog. I am hoping to check out the same high-grade content from you in the future as well. In fact, your creative writing abilities has motivated me to get my own website now ;)
    I'm more than happy to find this page. I wanted to thank you for your time for this wonderful read!! I definitely enjoyed every bit of it and I have you bookmarked to check out new things in your web site.
    Gran Canaria gay village

    ReplyDelete
  29. Hi here you can findevery solution releated to the android for
    like. if you want to customize your android phone i will help you
    Moreandroidmist if you want to find best android app related to every field this
    website help you like you want to see businsess app education app etc.
    so please visit my site for android problem androidmist thank you

    ReplyDelete
  30. Apple utilized their technology to present iOS and increased an early market advantage.best place to buy a cheap domain name

    ReplyDelete
  31. Hi there! This blog post could not be written much better! Going through this post reminds me of my previous roommate! He constantly kept preaching about this. I am going to forward this article to him. Fairly certain he's going to have a great read. Thanks for sharing!
    Roof Repair

    ReplyDelete
  32. Profi Fachübersetzung für medizinische Übersetzung. Professionelle Fachübersetzungen im pharmazeutischen und medizinischen Bereich.
    Professionelle Ubersetzungen für Geschäftskunden.medezinische Übersetzung Englisch Deutsch Braunschweig-Hildesheim-Salzgitter Höchste Vertraulichkeit. Bei Profi Fachübersetzung steht die Qualität der Medizin und Pharma-Übersetzungen an höchster Stelle, Qualifizierte Übersetzer. ISO 17100 zertifiziert, juristisch und
    technische Übersetzung

    ReplyDelete
  33. In their first since forever football match-up against Auburn, Tech would utilize gold on their football garbs,Concise

    ReplyDelete
  34. Lasers have discovered applications in numerous territories since their innovation. Present day medication uses lasers for medical procedure, having understood the capacity to perform less intrusive surgeries than before.Sean Coby's blog

    ReplyDelete
  35. Hi! This is my first comment here so I just wanted to give a quick shout out and say I genuinely enjoy reading your blog posts. Can you recommend any other Beauty Write For Us blogs that go over the same topics? Thanks a ton!

    ReplyDelete
  36. Hi! This is my first comment here so I just wanted to give a quick shout out and say I genuinely enjoy reading your blog posts. Can you recommend any other Beauty Write For Us blogs that go over the same topics? Thanks a ton!

    ReplyDelete
  37. Just need to state your article is as astonishing. The lucidity on your set up is basically cool and I could assume you're a specialist in this subject.



    binary option auto trading

    ReplyDelete
  38. The Georgia Institute of Technology was set up close to the city furthest reaches of Atlanta in 1885. best laptop for interior design

    ReplyDelete
  39. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. Great work Fashion

    ReplyDelete
  40. Commercial Locksmith Services
    You’ve made some good points there. I looked on the internet for additional information about the issue and found most people will go along with your views on this website.
    Nice post. I learn something totally new and challenging on websites I stumbleupon every day. It’s always useful to read through articles from other authors and practice something from other sites.

    ReplyDelete
  41. Thank You Sir, I try that tutorial and successfully added JQuery Library. I hope that you will give us another tutorial JQuery Library Using NuGet. Also see New Mobile Phone Price in Bangladesh, It is exceptionally enlightening and helpful for me.

    ReplyDelete
  42. Thanks for sharing this awesome article keep sharing. Learn More

    ReplyDelete
  43. We are Fire & Ice. Offering bespoke wedding photography. Learn More

    ReplyDelete
  44. Certainly, exercise can improve your physical wellbeing and your build, trim your waistline, improve your sexual coexistence, and even add a very long time to your life.

    Learn More

    ReplyDelete
  45. Exercise is a characteristic and successful enemy of uneasiness treatment
    Learn More

    ReplyDelete
  46. Thanks for sharing such type of information you can also check my post about best large tablets .

    ReplyDelete
  47. You also need to practice shooting a bow for a longer time, especially the ones which have a long arm. As you get used to shooting the archery bow, assam results you can add more features to your bows and even add arrows to your bows. So always keep practicing and you will be shooting the bow and arrow's the way it was meant to be shot, with confidence.

    ReplyDelete
  48. I like this concept. I visited your blog for the first time and became your fan. Keep posting as I am going to read it everyday.thanks for this article

    ReplyDelete
  49. Award Winning Wedding Photographer serving the South in across the usaIndiana Wedding Photographers visit website and hire photographer.

    ReplyDelete
  50. Markets dominated by larger, skilled organisations can seem impenetrable to small businesses, as they can't compete with the vast promotional budgets and economies of scale required to succeed. EPOS and stock management

    ReplyDelete
  51. Thanks for the valuable information and insights you have so provided here Mobile Phone Prices in Bangladesh

    ReplyDelete

Search This Blog