Home > Software engineering >  The reason why JavaScript is not running on the main page of Blazer
The reason why JavaScript is not running on the main page of Blazer

Time:08-09

The reason why JavaScript is not running on the main page of the Blazer, considering that we have access to the main file when running the web application and the link to the JavaScript file, it works correctly, and when you click on it, the code is displayed correctly and completely in the Ceres section. It will be given. But the JavaScript function is not called or is not executed at all. My codes are as follows:

function opeSublist() {
  try {

    if (checkFirstList == 0) {
      checkFirstList = 1;
    }
    var checkList = document.getElementById('FirstList');
    checkList.getElementsByClassName('anchor')[0].onclick = function(evt) {
      if (checkList.classList.contains('visible'))
        checkList.classList.remove('visible');
      else
        checkList.classList.add('visible');
    }
  } catch {}
}
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  <title>Blazor App</title>
  <base href="/" />
  <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
  <link href="css/app.css" rel="stylesheet" />
  <link href="LosacoWeb.Client.styles.css" rel="stylesheet" />
  <link href="css/app.css" rel="stylesheet" />
  <script src="multiselect-dropdown.js"></script>
  <script>
    navigator.serviceWorker.register('service-worker.js');
  </script>
  <link href="_content/Blazored.Modal/blazored-modal.css" rel="stylesheet" />
  <link href="LosacoWeb.Client.styles.css" rel="stylesheet" />
  <script src="_content/Blazored.Modal/blazored.modal.js"></script>
  <script src="js/jquery-2.1.1.min.js"></script>
  <link href="manifest.json" rel="manifest" />
  <link rel="icon" href="images/cropped-lorchlogo-2022-32x32.png" sizes="32x32" />
  <link rel="icon" href="images/cropped-lorchlogo-2022-192x192.png" sizes="192x192" />
  <link rel="apple-touch-icon" sizes="512x512" href="images/logoFa512.png" />
  <link href="_content/Blazor.PersianDatePicker/datepicker.css" rel="stylesheet" />
</head>

<body dir="rtl">
  <div id="app">
    <div  style="margin-top:10%;">
      <div >
        <img src="images/LogoFaNew.png" />
        <div >
          <div ></div>
        </div>
      </div>
    </div>
  </div>
  <div id="blazor-error-ui">
    Error ...!
    <a href="" >Referesh . . .</a>
    <a >           
  • Related