Reputation: 563
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>
Upvotes: 1
Views: 213
Reputation: 731
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>
Upvotes: 1