<head> <script src="/jquery/jquery-1.11.1.min.js"> </head>
If it is not downloaded to the public file, it can be directly referenced by the same address.
Use Google's CDN
<head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs /jquery/1.8.0/jquery.min.js"></script> </head>
Use Microsoft's CDN
<head> <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery /jquery-1.8.0.min.js"></script> </head>
2. Introduce external js files into HTML:
<script type="text/javascript" src="{% static 'pos/js/pos.js' %}"></script>
3. The syntax of the functions in the js file:
jQuery syntax
jQuery syntax is prepared for the selection of HTML elements, and can perform certain operations on elements.
The basic syntax is: $(selector).action() selector // "query" and "find" HTML elements jQuery's action() // perform operations on elements
All jQuery functions are in a document ready function:
$(document).ready(function(){ --- jQuery functions go here ---- });
$(document).ready(function(){
--- jQuery functions go here ----
});