How to add jQuery to Sublime Text 2?

This may seem silly.

But how do you add jQuery to sublime text 2?

It does not seem to work.

I added this github.

Then a jQuery folder was created in my packages.

Finally, I added this to my headlines.

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

But still no luck.

+6
source share
2 answers

Sublime Text 2 uses JavaScript syntax to support jQuery. Looking at the Github repository, you tried, I assume you want some kind of fragment library. I would recommend this instead: https://github.com/aaronpowell/sublime-jquery-snippets and / or https://github.com/SublimeText/jQuery .

To clarify something else for you, add:

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

Adds a jQuery library to your HTML page so you can use its methods and functions. He does not add it to Sublime Text 2, but it is nevertheless necessary for the above reason.

+5
source

first add package management to Sublime Text. It is accessed using ctrl + `shortcut. After opening, paste the code from here into the console and press Enter.

Go to "Settings"> "Package Management"> in this list, click on "Package Management Package Installation Package", then search for jQuery. This will install jQuery.

Now, if you want autocompletion for jQuery, follow these steps:

  • Domnload this: package from github
  • Extract the contents to a place that you can quickly access, find the file "AndyjQuery.sublime-completions".
  • Not sure if it will work just by placing the file with the current name, so I renamed it as "jQuery.sublime-completions"
  • Place this file in the jQuery folder from the place that opens when you go to Settings - Package Overview

if you want to use autocomplete when you click a point: Go to the "Settings - User Settings" section and add this

"auto_complete_triggers": [{"selector": "source.js", "characters": "." }],

+12
source

Source: https://habr.com/ru/post/922684/


All Articles