Adding jQuery and Bootstrap to Write a Mobile-Friendly and Responsive Web Application

In Part 1 of this series, we set up a basic HTML 5 project using Netbeans as our IDE, and we also presented a few elements that have been added in this new specification...

Spread the love

In Part 1 of this series, we set up a basic HTML 5 project using Netbeans as our IDE, and we also presented a few elements that have been added in this new specification of the language.

Create Mobile-Friendly Responsive Websites

Create Mobile-Friendly Responsive Websites – Part 2

In few words, you can think of jQuery as a cross-browser and cross-platform Javascript library that can greatly simplify client-side scripting in HTML pages. On the other hand, Bootstrap can be described as a complete framework that integrates HTML, CSS, and Javascript tools to create mobile-friendly and responsive web pages.

In this article we will introduce you to jQuery and Bootstrap, two priceless utilities to write HTML 5 code more easily. Both jQuery and Bootstrap are licensed under the MIT and Apache 2.0 licenses, which are compatible with the GPL and are thus free software.

Please note that basic HTML, CSS, and Javascript concepts are not covered in any article of this series. If you feel you need to get up to speed with this topics first before proceeding, I highly recommend the HTML 5 tutorial in W3Schools.

Incorporating jQuery and Bootstrap into Our Project


To download jQuery, go to the project’s web site at http://jquery.com and click on the button that displays the notice for the latest stable version.

At the time of this writing it’s v1.11.3 for full-browser compatibility (including Internet Explorer versions 6, 7, and 8) or v2.1.4 if you’re sure that your visitors will not be using those versions of IE.

We will go with this second option in this guide. DO NOT click on the download link yet (the following illustration is only meant to indicate which is the right option).

Download JQuery

Download JQuery

You will notice that you can download either a compressed .min.js or an uncompressed .js version of jQuery. The first is meant specially for websites and helps reduce the load time of pages (and thus Google will rank your site better), while the second is targeted mostly at coders for development purposes.

For the sake of brevity and easiness of use, we will download the compressed (also known as minified) version to the scripts folder inside our site structure.

Right click on the link for the compressed, production version and choose Save Link As…, and then navigate to the indicated directory (you may want to refer to the path indicated where we chose to save our project in Part 1).

Finally, click Save on the bottom of the current dialog:

Save jQuery

Save jQuery

Now it’s time to add Bootstrap to our project. Go to http://getbootstrap.com and click on Download Bootstrap. On the next page, click on the highlighted option as indicated below to download the minified components, ready to use, in a zip file:

Download Bootstrap

Download Bootstrap

When the download completes, go to your Downloads folder, unzip the file, and copy the highlighted files to the indicated directories inside your project:

# cd ~/Downloads
# unzip -a bootstrap-3.3.5-dist.zip
# cd bootstrap-3.3.5-dist
Install Bootstrap

Install Bootstrap

# cp css/bootstrap.min.css /home/gabriel/NetBeansProjects/TecmintTest/public_html/styles
# cp fonts/* /home/gabriel/NetBeansProjects/TecmintTest/public_html/fonts
# cp js/bootstrap.min.js /home/gabriel/NetBeansProjects/TecmintTest/public_html/scripts

If you now expand the structure of your site in Netbeans, it should look as follows:

Site Structure in Netbeans

Site Structure in Netbeans

Facebook Comments
Spread the love

Posted by News Monkey