How to create a website using jQuery


In the previous jQuery lesson, did Taimienphi.vn introduce you to jQuery? In the next lesson below, Betdownload.com will introduce you how to create a website using jQuery.


To learn how to create a website using jQuery, read along to the following article of Taimienphi.vn. Also readers can refer to some other jQuery lessons already on Taimienphi.vn to learn how to create websites with Bootstrap.

How to create a website using jQuery

1. Download jQuery

The first step is to download jQuery and add it to your document. There are 2 jQuery sessions available for download, including 1 compressed and 1 uncompressed version.

While uncompressed files are suitable for development or debugging, Taimienphi.vn recommends downloading compressed files to save bandwidth and improve download performance due to small file sizes.

To download jQuery to your computer and use it, visit here.

Link:

If you notice, you will see that the downloaded jQuery file has an extension of .js. Because jQuery is just a JavaScript library, we can easily add jQuery files in our HTML documents with the script, similar to the way we add regular JavaScript files.

For example: The following example illustrates how to add jQuery file to HTML document:

how to create a jquery bang website

The result will look like this:

jquery web programming

Note: Add the jQuery file before the custom script, otherwise the jQuery API will not be available when your jQuery code tries to access.

Tips: We can omit the attribute type = “text / javascript” in the card script. This is because JavaScript is the default scripting language in HTML5 and modern web browsers. However, if you wish, you can still use this property to make the code easier to understand.

2. Add jQuery to the document via CDN

If you don’t want to download and host jQuery, we can also add jQuery to the document via the free CDN links available.

Using CDN helps improve performance by reducing load time because jQuery is hosted on many global servers, and when users request it, the file will be downloaded from the server closest to them.

Also, if your site visitors download jQuery copy from the same CDN while visiting other websites, they don’t have to download again because the website is cached in the browser cache. .

JQuery CDN provided by MaxCDN:

create jquery state website 3

You can also add jQuery via Google and Microsoft CDNs.

How to create a website using jQuery

The final step is to use jQuery to refine the look of the document. In the example below, Taimienphi.vn will perform a simple operation with jQuery by changing the color of the text from the default black to red:

create jquery state website 4

The result will look like this:

create jquery bang website 5

In the example on Taimienphi.vn, perform simple manipulations with jQuery by changing the color of the title, ie the element. h1 using the selector element in jQuery and methods css () when the event is ready

The above lesson has shown you how to create a website using jQuery. In the next lesson, Taimienphi.vn will introduce you further jQuery syntax The most basic.

https://thuthuat.taimienphi.vn/cach-tao-page-web-bang-jquery-51216n.aspx
In addition, if you have any questions or questions, you can leave your comments in the comment section below the article.

.

Add a Comment

Your email address will not be published. Required fields are marked *