Class: BESE-10AB: Department of Computing
Class: BESE-10AB: Department of Computing
Class: BESE-10AB
Lab 07: jQuery
Introduction:
jQuery is a widely used and well-known library for JavaScript which helps in rapid web
development. Most of the modern websites use jQuery as a tool to implement and control
client side dynamic behavior of the websites. Students have learned basic and advanced
concepts of jQuery during lectures. This lab will help them to further understand these
concepts by practically using jQuery in given situations.
Lab Objectives:
The objective of this lab is helping students to familiarize themselves with basic and advanced
concepts of jQuery by practically implementing them in given scenarios. The knowledge
students have gained in the lectures will help them to develop and control dynamic behavior of
web pages using jQuery.
Tools:
Notepad, DreamWeaver, browser.
Helping Material:
Lecture slides.
W3Schools: https://www.w3schools.com/js/default.asp
Lab Task
Task 1
During lectures, students have seen a basic version of the ‘buy groceries’ example. This basic
version is given in ‘grocery-basic-skeleton.html’ file along with CSS and JavaScript (see ‘lab-7-
supporting-material.zip’). Using jQuery, you have to change the behavior of the list items <li> as
explained below:
1. When you click on any list item <li>, it should display current date and time in the
format shown in the image below.
Task 2
Using the ‘grocery-basic-skeleton.html’ file, you have to change the behavior of the list items
(using jQuery) as explained below:
3. The promotion div must disappear as soon as the user scrolls the page up to 500px from
the bottom.
Hints:
Use $window.scrollTop() to get the current vertical position of the scroll bar.
Use following formula to find if the user is within bottom 500px of the page.
o $('#footer').offset().top - $window.height() – 500
Use $window.on (‘scroll’, function(){….} to handle onScroll() event of the window.
jQuery’s animate() function will help you achieving this task.
Task 4
Extend the ‘task-4-skeleton.html’ file and add following two functionalities using jQuery:
1. Add functionality for ‘add row’ button which should add a new row with the data
entered by the user in Name and Email Address text fields. The table should be
extended dynamically and new row should be appended at the end.
Note: Upload complete solutions (css, html, js) for each task in in a single zip file along with
adding jQuery and screenshots of your solutions in this word file.
Solution
Task 1 jQuery:
Task 1 screenshot:
Task 2 jQuery:
Task 2 screenshot:
Task 3 screenshot:
Task 4 jQuery:
Task 4 screenshot:
Deliverables
Compile a single word document by filling in the solution part and submit this Word file on LMS.
You must include your name, ID, and class on first page. The lab grading policy is as follows: The
lab is graded between 0 to 10 marks. For some of the labs, students have to present their
solutions in a viva session. In case of any problems with submissions on LMS, you should
contact your lab engineer Ms. Ayesha Asif by email at [email protected].