Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 72388

document.querySelector() not working in mobile

$
0
0

I have a footer that is included in a webpage with a small javascript. Here is the small javascript:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>This is a Webpage</title>
    <SCRIPT src="js/jquery-3.2.1.min.js"></SCRIPT>
<script>
  $(function(){
    var includes = $('[data-include]');
    jQuery.each(includes, function(){
      var file = '/en/inc/' + $(this).data('include') + '.html';
      $(this).load(file);
    });
  });
</script>
</head>
<body>
<div data-include="menu"></div>
<BR><BR><BR>
Content goes here
<BR><BR><BR>
<div data-include="footer"></div>
</body>
</html>

And here is the footer that is being loaded through js:

<p>
                        Copyright &copy;
          <script>
            document.querySelector('#rights').innerHTML = `Copyright &copy; ${new Date().getFullYear()}
            All rights reserved | This template is made with <i class="fa fa-heart-o" aria-hidden="true"></i> by <a href="https://colorlib.com" target="_blank">Colorlib</a>`;
          </script>
                    </p>

As you can see the footer contains another small javascript, which was given to me in a stackoverflow question (JQuery .load() function doesn’t work because file loaded contains small JS). The hack works fine, except in mobile: when I open the webpage in mobile, the copyright doesn’t show ( http://guardian-angels.orgfree.com/ ). Can anybody help me fix it please? I’m very new to webpage stuff.


Viewing all articles
Browse latest Browse all 72388

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>