Hello Guys I would like to know if it is possible to hide the div if the internet is not availaible. Here is the code
if(navigator.onLine) { 
     //show
}
else{
//Hide
} Thanks in advance.
Hello Guys I would like to know if it is possible to hide the div if the internet is not availaible. Here is the code
if(navigator.onLine) { 
     //show
}
else{
//Hide
} Thanks in advance.
 
    
    You can check whether the internet is connected or not by
window.onload = checkInternetConnection;
function checkInternetConnection() {
  var isOnLine = navigator.onLine;
   if (isOnLine) {
      alert(connectionMessage);
   } else {
     alert(noConnectionMessage);
   }
}
so if isOffline, You can use jquery to hide that specific div like
$('.div_class_name').hide();
and if online, use
$('.div_class_name').show();
 
    
    You can use JQuery.
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
Code:
    $(document).ready(function(){
      if(navigator.onLine) { 
           $("#element-id").show();
        }
        else{
          $("#element-id").hide();
        } 
    });.