0

I have problem with hosting my website in react. I choose hostinger, but when I upload my all files and add file ‘.htaccess’, I see in Console something like this:

Uncaught TypeError: Cannot set properties of null (setting 'innerHTML') at (index):416:27

(..)    
<script>
    var pathName = window.location.hostname;
    var account = document.getElementById("pathName");
    var accountText = document.getElementById("website");
    account.innerHTML = pathName;
    accountText.innerHTML = pathName; //in this line I can see error 'pathName' is highlight
</script>
</body>

</html>
Martulka
  • 7
  • 2
  • 1
    The thing you are trying to set the innerHTML of (either `account` or `accountText`) is null/undefined. Check https://stackoverflow.com/questions/14028959/why-does-jquery-or-a-dom-method-such-as-getelementbyid-not-find-the-element – James Apr 19 '22 at 19:07
  • Have you confirmed that the element with an id="website" exists in the html of the uploaded site? – Pellay Apr 19 '22 at 19:07
  • Then one or more of the `document.getElementById` calls didn't find the target element. The code shown certainly doesn't have either of those elements. Also, what does this have to do with React? The code shown is very much *not* React. – David Apr 19 '22 at 19:07

0 Answers0