1

I have got a file called report.js which has a variable called "number". I would like to show this number in the html page.

report.js is as below:

var number;

module exports:{}

    getData:function(data){
    //calculate number

}

and the index.html is as below: ...

<body>
<div class="page">
    <header style="position: relative;">
        <h1 style="margin-left: 140px;" id="newNumber"></h1> 
    </header>


<script>
    $("#newNumber").html('<div align="left">Number is '+ number +'</div>');
</script>

</body>

should I add this line? and where?

<script type='text/javascript' src='js/report.js'></script> 

1
  • 1
    You cannot use module exports in client side javascript Commented Jun 15, 2015 at 13:21

1 Answer 1

1

Add that line in the header. It will go in the same place as your document title.

<head> <script type='text/javascript' src='js/report.js'></script> </head>

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.