<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Developer Corner</title>
<!-- CSS only -->
<link id="darkTheme" href="https://vm-services.tech/developerCorner/css/changeDark.css" disabled="disabled" rel="stylesheet" />
<link id="lightTheme" href="https://vm-services.tech/developerCorner/css/changeWhite.css" rel="stylesheet" />
<!-- Js -->
<script src="https://code.jquery.com/jquery-3.6.1.min.js" crossorigin="anonymous"></script>
</head>
<body>
<h3>Hello Developer</h3>
<div id="changeTheme"><button onclick="changeMyCss('dark')">click for Dark Mode</button></div>
</body>
</html>
<script>
function changeMyCss(theme)
{
var html = '';
if(theme == 'dark'){
$('#lightTheme').attr('disabled', 'disabled');
$('#darkTheme').removeAttr('disabled');
html+='<button onclick="changeMyCss(\'light\')">click for Light Mode</button>';
}else{
$('#darkTheme').attr('disabled', 'disabled');
$('#lightTheme').removeAttr('disabled');
html+='<button onclick="changeMyCss(\'dark\')">click for Dark Mode</button>';
}
$('#changeTheme').html(html);
}
</script>
0 Comments (Please let us know your query)