<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../bootstrap-4.6.0-dist/css/bootstrap.min.css">
<title>๐KOHARIN๐</title>
<style>
.dark{
background-color:black;
color:white;
}
</style>
</head>
<body>
<article>
<header>
<h2>๐Day and ๐Night Mode</h2>
<p>
<button type="button" class="btn btn-outline-light" id="dnn">Light</button>
<label>๐ click button here.</label></p>
</header>
<p>Which color? Black or White??</p>
</article>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="../bootstrap-4.6.0-dist/js/bootstrap.min.js"></script>
<script>
$(document).ready(function(){
$('#dnn').click(function(){
$('body').toggleClass('dark');
})
});
</script>
</body>
</html>
$(document).ready(function(){
// do somthing
});
$(function () {
// Do something...
});
<button type="button" class="btn btn-light" id="dnn">Day</button>
<button type="button" class="btn btn-dark" id="dnn">Night</button>
<button type="button" class="btn btn-outline-light" id="dnn">Day</button>
<button type="button" class="btn btn-outline-dark" id="dnn">Night</button>
[Web ๊ฐ๋ฐ] Day and Night Mode #2 (jQuery, Bootstrap) (0) | 2021.02.19 |
---|---|
jQuery #1 (0) | 2021.02.18 |
[JavaScript] JavaScript #5: ์คํ ์ปจํ ์คํธ (0) | 2021.02.01 |
[JavaScript] this (0) | 2021.02.01 |
[TestDome] HTML/CSS and JavaScript: Semantics (HTML5, CSS3) (0) | 2021.01.31 |