Sample DLP TVL Programming
Sample DLP TVL Programming
In
Technology and Livelihood Education III
ICT – HTML
I. Objective
At the end of a 60 minute lesson, 100% of the students should be able to get at least 75% level of mastery on
how to:
Describe the use of jQuery to simplify code that uses many common JavaScript APIs.
Write JavaScript/jQuery code that manipulates the HTML document object model and handle events.
References: www.w3schools.com
Learning jQuery
Fourth Edition p12-17
III. Procedure
A. Pre-developmental Activity
1. Review
Present the previous lesson about the jQuery set up and syntax, and the
folder structure on how to use the jQuery Library.
B. Developmental Activities
</body>
</html>
Save the file as “index.html” in “mypage” folder that you have just created.
Open the “index.html” using your internet browser application (use the Internet Explorer or Google Chrome).
C. Post Developmental Activities
1. Practice Exercise.
Create a jQuery code that will add two number and display the sum.
Html input:
<button>Compute Sum</button>
jQuery Code:
1. <script>
$(document).ready(function(e) {
$("#compute").click(function(){
var a,b, total;
a=$("#numA").val();
b=$("#numB").val();
Conditional Statement
Conditional statements are used to perform different actions based on different conditions.
Very often when you write code, you want to perform different actions for different decisions.
Example:
var x;
if(x>5)
{
alert(“x is greater than 5”
}
else if (x<5){
alert(“x is lesser than 5”)
}
else{
alert(“x equal to 5”)
}
2. Generalization
Describe the use of jQuery to simplify code that uses many common JavaScript APIs.
jQuery greatly simplifies JavaScript programming. Given the following scenario, if we are going
to access the value of an element in JavaScript we use the code
document.getElementById(“idname”).value, while in jQuery we simply write
$(“#idname”).val();
IV. Evaluation
Challenging Activity
Where: Fa = Fahrenheit
Ce= Celsius
V. Assignment
Create a program that will change the background of the browser with the following condition:
if the input value of the text box is less than 10 the body background would be Red.
if the input value of the text box is greater than 10 the body background would be black.