Uncaught TypeError: Cannot set property innerHTML of null

Mas Bro,.. ada yang tahu ini kenapa yach ??

berikut codenya :

 <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="shortcut icon" type="image/icon" href="http://localhost/partsystem/assets/Adminlte/AdminLTE-2.0.5/dist/img/simbol-mes50x28.jpg"/>
<title>PT. Metindo Erasakti</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<!-- Bootstrap 3.3.2 -->
<link rel="stylesheet" type="text/css" href="http://localhost/partsystem/assets/Adminlte/AdminLTE-2.0.5/plugins/bootstrap-select/css/bootstrap-select.min.css">

<link rel="stylesheet" type="text/css" href="http://localhost/partsystem/assets/Adminlte/AdminLTE-2.0.5/bootstrap/css/bootstrap.min.css">
<!-- Font Awesome Icons -->
<link  rel="stylesheet" type="text/css" href="http://localhost/partsystem/assets/Adminlte/font-awesome-4.3.0/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" type="text/css" href="http://localhost/partsystem/assets/Adminlte/ionicons-2.0.1/css/ionicons.min.css">

<link rel="stylesheet" type="text/css" href="http://localhost/partsystem/assets/Adminlte/AdminLTE-2.0.5/plugins/datatables/dataTables.bootstrap.css">

<link rel="stylesheet" type="text/css" href="http://localhost/partsystem/assets/Adminlte/AdminLTE-2.0.5/plugins/morris/morris.css">
<!-- Theme style -->
<link rel="stylesheet" type="text/css" href="http://localhost/partsystem/assets/Adminlte/AdminLTE-2.0.5/dist/css/AdminLTE.min.css">
<link rel="stylesheet" type="text/css" href="http://localhost/partsystem/assets/Adminlte/AdminLTE-2.0.5/dist/css/skins/_all-skins.min.css">

<!--<link rel="stylesheet" href="">

<link rel="stylesheet" href="">-->

<!--<link rel="stylesheet" href="">-->

</head>
    <style>
        #jam-digital{overflow:hidden; width:350px}
        #hours{float:left; width:100px; height:50px; background-color:#6B9AB8; margin-right:25px}
        #minute{float:left; width:100px; height:50px; background-color:#A5B1CB}
        #second{float:right; width:100px; height:50px; background-color:#FF618A; margin-left:25px}
        #jam-digital p{color:#FFF; font-size:36px; text-align:center; margin-top:4px}
    </style>
<body class="skin-blue">
    <!-- Site wrapper -->
    <div class="wrapper">
        <header class="main-header">
            <a href="#" class="logo">
                <span class="logo-lg"><strong>PT. Metindo Erasakti</strong>
                    </span>
            </a>
            <!-- Header Navbar: style can be found in header.less -->
            <nav class="navbar navbar-static-top" role="navigation">
                <!-- Sidebar toggle button-->
                <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
                    <i class="fa fa-arrow-left" aria-hidden="true"></i>
                </a>
                    <div class="navbar-header">
                         <a class="navbar-brand"><strong> Sistem Information Management </strong></a>
                    </div>
                <div class="navbar-custom-menu">
                    <ul class="nav navbar-nav">
                        <!-- Messages: style can be found in dropdown.less-->
                        <li class="dropdown messages-menu">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <i class="fa fa-envelope-o"></i>
                                <span class="label label-success">7</span>
                            </a>
                            <ul class="dropdown-menu">
                                <li class="header">You have 7 messages</li>
                                <li>
                                    <!-- inner menu: contains the actual data -->
                                    <ul class="menu">
                                        <li><!-- start message -->
                                            <a href="#">
                                                <div class="pull-left">
                                                    <img src="http://localhost/partsystem/assets/Adminlte/AdminLTE-2.0.5/dist/img/henry-smallsize.jpg" class="img-circle" alt="User Image"/>
                                                </div>
                                                <h4>
                                                    Support Team
                                                    <small><i class="fa fa-clock-o"></i> 5 mins</small>
                                                </h4>
                                                <p>Why not buy a new awesome theme?</p>
                                            </a>
                                        </li><!-- end message -->
                                    </ul>
                                </li>
                                <li class="footer"><a href="#">See All Messages</a></li>
                            </ul>
                        </li>
                        <!-- Notifications: style can be found in dropdown.less -->
                        <!--li class="dropdown notifications-menu">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <i class="fa fa-bell-o"></i>
                                <span class="label label-warning">10</span>
                            </a>
                            <ul class="dropdown-menu">
                                <li class="header">You have 10 notifications</li>
                                <li>
                                    <!-- inner menu: contains the actual data -->
                                    <!--ul class="menu">
                                        <li>
                                            <a href="#">
                                                <i class="fa fa-users text-aqua"></i> 5 new members joined today
                                            </a>
                                        </li>
                                    </ul>
                                </li>
                                <li class="footer"><a href="#">View all</a></li>
                            </ul>
                        </li>-->
                        <!-- Tasks: style can be found in dropdown.less -->
                        <!--li class="dropdown tasks-menu">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <i class="fa fa-flag-o"></i>
                                <span class="label label-danger">9</span>
                            </a>
                            <ul class="dropdown-menu">
                                <li class="header">You have 9 tasks</li>
                                <li>
                                    <!-- inner menu: contains the actual data -->
                                    <!--ul class="menu">
                                        <li><!-- Task item -->
                                            <!--<a href="#">
                                                <h3>
                                                    Design some buttons
                                                    <small class="pull-right">20%</small>
                                                </h3>
                                                <div class="progress xs">
                                                    <div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
                                                        <span class="sr-only">20% Complete</span>
                                                    </div>
                                                </div>
                                            </a>
                                        </li><!-- end task item -->
                                  <!--  </ul>-->
                                <!--</li>-->
                      <!--          <li class="footer">
                                    <a href="#">View all tasks</a>
                                </li>
                            </ul>
                        </li>-->
                        <!-- User Account: style can be found in dropdown.less -->
                        <li class="dropdown user user-menu">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <img src="http://localhost/partsystem/assets/Adminlte/AdminLTE-2.0.5/dist/img/henry-smallsize.jpg" class="user-image" alt="User Image"/>
                                <span class="hidden-xs">Hello,..Welcome Admin</span>
                            </a>
                            <ul class="dropdown-menu">
                                <!-- User image -->
                                <li class="user-header">
                                    <img src="http://localhost/partsystem/assets/Adminlte/AdminLTE-2.0.5/dist/img/henry-smallsize.jpg" class="img-circle" alt="User Image" />
                                    <p>
                                        Admin - IT Staff
                                        <small>ID 1481</small>
                                    </p>
                                </li>
                                <!-- Menu Body -->
                                <li class="user-body">
                                    <div class="col-xs-4 text-center">
                                        <a href="#">Followers</a>
                                    </div>
                                    <div class="col-xs-4 text-center">
                                        <a href="#">Sales</a>
                                    </div>
                                    <div class="col-xs-4 text-center">
                                        <a href="#">Friends</a>
                                    </div>
                                </li>
                                <!-- Menu Footer-->
                                <li class="user-footer">
                                    <div class="pull-left">
                                        <a href="#" class="btn btn-default btn-flat">Profile</a>
                                    </div>
                                    <div class="pull-right">
                                        <a href="http://localhost/partsystem/auth/logout" class="btn btn-default btn-flat">Sign out</a>
                                    </div>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </nav>
        </header>
        <!-- =============================================== -->
<script type="text/javascript">
      window.setTimeout("wkt()",1000);
      function wkt() {
        var tanggal = new Date();
        setTimeout("wkt()",1000);
        document.getElementById("jam").innerHTML = tanggal.getHours();
        document.getElementById("menit").innerHTML = tanggal.getMinutes();
        document.getElementById("detik").innerHTML = tanggal.getSeconds();
      };
</script>

jadi masalah itu akan terus error jika kita berada di halaman pertama ( index ) atau menu dashboard, dan error itu akan terus jika kita tidak merubah atau klik menu atau halaman yang lain....

mohon pencerahan dari suhu, guru atau master,.. atas perhatiannya saya ucapkan banyak terima kasih.... salam.

avatar gopei
@gopei

71 Kontribusi 1 Poin

Diperbarui 5 tahun yang lalu

Tanggapan

element dengan id "jam" emang gaada gan?

2 Jawaban:

Jawaban Terpilih

arti errornya element ini ngga bisa ditemukan document.getElementById("jam"). pastikan kamu punya elemen yang idnya jam

avatar hilmanski
@hilmanski

2686 Kontribusi 2135 Poin

Dipost 5 tahun yang lalu

Tanggapan

Gimana caranya ketika kita pindah ke halaman lain => Uncaught TypeError: Cannot set property innerHTML of null ini tidak muncul?

OK kang @Hilmanrdn... thanks a lot.. sudah SOLVED.. makasih kang

avatar gopei
@gopei

71 Kontribusi 1 Poin

Dipost 5 tahun yang lalu

Login untuk ikut Jawaban