0

I am trying to display content using javascript DOM but every time I run my solution I get a blank page. My HTML file is as follows:

<!DOCTYPE html>
    <html>
    <head>
        <title>Radiant HQ</title>

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    </head>
    <body>
        <nav id="navigationcontent"></nav>
        <script type="text/javascript" src="assets/js/radiant.js">
        </script>
    </body>
</html>

My js file looks this way:

@import ('../css/style.css');
document.getElementById("navigationcontent").innerHTML=`
<ul>
    <li><a href="">Home</a> </li>
    <li><a href="">About Us</a> </li>
    <li><a href="">Research</a> </li>
    <li><a href="">Contacts</a> </li>
</ul>`;
2
  • 2
    @import ('../css/style.css'); why is this in javascript snippet? Commented Mar 16, 2020 at 21:38
  • ^ This. And have you looked at your DevTools console for more information? Commented Mar 16, 2020 at 21:58

1 Answer 1

1

Your code works. There is one problem though.

It's getting stuck on the @import ('../css/style.css'); line. Try removing that whole line and include your CSS some other way. Typically this in done in the head of the document via html.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.