Latihan JQuery
Latihan JQuery - Pemrograman Web
Nama : Abidjanna Zulfa Hamdika
NRP : 5025201197
==================================================================================================
A. Deskripsi
Latihan menggunakan JQuery
B. Detail Tugas
Source Code index.html :
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<!-- Required meta tags --> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<!-- Bootstrap CSS --> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous"> | |
<link rel="stylesheet" href="style.css"> | |
<title>Contoh Program Jquery Sederhana Part 1</title> | |
</head> | |
<body> | |
<br> | |
<br> | |
<br> | |
<!-- Buat h1 untuk menampilkan nilai ketika tombol tekan di klik--> | |
<center><p>Press the button to start counting</p></center> | |
<center><h1> 0 </h1></center> | |
<!-- Buat tombol--> | |
<center><button type="button" class="btn btn-primary">Tekan!</button></center> | |
<!-- Option 1: jQuery and Bootstrap Bundle (includes Popper) --> | |
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> | |
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns" crossorigin="anonymous"></script> | |
<script> | |
//Ketika dokumen HTML sudah siap di reload | |
$(document).ready(function() { | |
//buat nilai 1 | |
var nilai = 1; | |
//ketika tombol tekan di klik | |
$(".btn").on("click", function(){ | |
//tambah nilai dan tampilkan pada h1 | |
$("h1").html(nilai++); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Source Code style.css :
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300&display=swap'); | |
body{ | |
background-color: #06283D; | |
color: #DFF6FF; | |
font-family: 'Poppins', sans-serif; | |
margin-top: 150px; | |
} | |
p{ | |
font-size: 20px; | |
font-weight: 300; | |
line-height: 1.5; | |
} | |
h1 { | |
font-size: 64px; | |
font-weight: 300; | |
line-height: 1; | |
margin-bottom: 15px; | |
} | |
.btn { | |
background-color: #256D85; | |
border: 0; | |
border-radius: 5px; | |
color: #DFF6FF; | |
cursor: pointer; | |
font-size: 20px; | |
font-weight: 300; | |
padding: 10px 20px; | |
text-transform: uppercase; | |
} | |
.btn:hover { | |
background-color: #47B5FF; | |
color: black; | |
} |
C. Repository
Repository : https://github.com/hufahamdika/Latihan_JQuery
Website : https://hufahamdika.github.io/Latihan_JQuery/
Comments
Post a Comment