Home >Web Front-end >Front-end Q&A >How to install jquery on mac (steps)
Installing jQuery on your Mac computer is very simple, just follow these steps:
First, you need to visit the jQuery official website (https:// jquery.com/) and click the Download button. You should see two download options: a compressed version and an uncompressed version. During this process, we will download the compressed version, which is a file called "jquery-x.x.x.min.js", where x.x.x represents the current version number.
Now, you need to open the text editor. The text editor that comes with Mac is TextEdit. You can find it in the Applications folder. If you want to use another text editor like Sublime Text or Atom, that's also possible.
In the text editor that opens, click the "File" menu and select the "New File" option. Alternatively, you can use the shortcut "Command N" to create a new file.
Now, you need to paste the downloaded jQuery file contents into the file you just created. Make sure to paste the content into a plain text editor to avoid any formatting issues.
The content of the jQuery file looks like this:
/*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */ !function(e,t){ "use strict"; "object"==typeof module&&"object"==typeof module.exports? module.exports=e.document?t(e,!0):function(e){ if(!e.document) throw new Error("jQuery requires a window with a document"); return t(e) }:t(e)}("undefined"!=typeof window?window:this,function(e,t){ "use strict"; var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function(e){ return"function"==typeof e&&"number"!=typeof e.nodeType}, . . .(此处省略...)
Now, you need to save the file to your Mac computer. Click the File menu and select the Save option. Just name the file "jquery.js" and save it wherever you want.
The last step is to link the jQuery file to your HTML file. To achieve this step, you need to add a