0

Yesterday I asked a question about setting the date of calendar in jquery. I found out my code was correct however I was missing the two references below.

https://cdnjs.cloudflare.com/ajax/libs/datepicker/0.6.5/datepicker.css
https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.css

I already am able to use the reference below in my web page.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

So I read I should install jQuery UI via nuget in Visual Studio. Here is where my problem began. Basically my company like to make things hard so whilst nuget is installed we are prevented from using it.

So I am trying to install jquery ui without Nuget but without success. I went to this page on jquery.com about downloaded the zip file. However I can't install it or use it?

Also I need the datepicker file which seems seperate to jquery-ui?

Update

So apologies, I know I am being quite dumb here but just trying to understand.

1) So in my project I created a CSS folder where I saved my own css file. And reference it like below.

<link href="CSS/myCSS.css" rel="stylesheet" type="text/css"/>

So with the files I downloaded from jquery I take it I can copy jquery-ui.css and jquery-ui.min.css into this folder and reference them in the same way,

<link href="CSS/jquery-ui.css" rel="stylesheet" type="text/css"/>
<link href="CSS/jquery-ui.min.css" rel="stylesheet" type="text/css"/>

2) Also in my project there is a folder called scripts. I have my own javascript file called myJS. I reference it like below,

<script src="scripts/myJS.js"></script> 

So from my download from jquery if I copy over jquery-ui.js and jquery-ui.min.js and the external directory and put them in my scripts folder I can reference the files as such,

<script src="scripts/external/jquery/jquery.js"></script>
<script src="scripts/jquery-ui.min.js"></script>
<script src="scripts/jquery-ui.js"></script>

And then remove this line as it will now not be needed.

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

Is that correct or am I still missing something?

5
  • "I can't install it or use it?"...why, what's wrong with it? you can just unzip the relevant files into your project in a suitable location and then add <script tags to your page to include them. The datepicker file is not necessarily separate - you can either load the whole of jQueryUI in one file, or pick and choose the bits you need as separate files. It's your choice. I suggest you read the jQueryUI download page in a bit more detail. Or you can avoid downloading anything and use a CDN, like the one in your example hyperlinks above. Again it's a design choice you can make. Commented Aug 3, 2018 at 8:59
  • All nuget does is just makes the same process a bit easier by automating the placing of the files into a suitable place in your project, and also informing you when there are upgrades available. Commented Aug 3, 2018 at 9:01
  • @ADyson ok I see. I know this is probably quite simple. I have added an update however not sure if my logic is still wrong Commented Aug 3, 2018 at 10:20
  • 2
    you don't need jquery.js and jquery.min.js - you're adding two copies of jQuery to your page, which won't work properly. (The .min.js is just a compressed version of the code, ideal for live environments where you don't need to do detailed debugging, and where you might want to save your (and the user's) bandwidth. Commented Aug 3, 2018 at 10:23
  • ok i see thanks very much! Commented Aug 3, 2018 at 10:31

1 Answer 1

1

simple you can download jquery-ui package and than put files from package to your project. download link : https://jqueryui.com/download/

after that you can import that files to your project like this :

<link rel="stylesheet" href="jquery-ui.min.css">
<script src="external/jquery/jquery.js"></script>
<script src="jquery-ui.min.js"></script>

actually nuget don't "installs" it in your project, it simply downloads it and than imports.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks for your answer. I have just updated my question including the code from your answer. My response was bit to long for a comment. Can you check if my understanding is correct?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.