So far in my javascript, I have this code: !/Users/me/Desktop/Screen Shot 2017-07-19 at 2.15.40 PM.png
@import "MochaJSDelegate.js";
@import 'common.js';
var word = "some kind of file";
function getWord(){
return word;
}
And I want to be able to use the "word" variable in my html over here:
<!doctype html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="style3.css">
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1.12.min.js"></script>
<script src = "../Sketch/login.js"> </script>
</head>
<body>
<div>
<div class = "title">
Botworx Sketch Plugin
</div>
<div class = "input-login">
<button onclick="displayFormContents(this.form);">Login</button>
</div>
<div class = "input-uploadImages">
<button onclick="displayFormContents(this.form);">Upload Images Only</button>
</div>
<div class = "input-uploadGalleryData">
<button id = "upload-gallery">Upload Gallery Data</button>
</div>
<div class = "input-uploadAll" >
<button id="uploadEverything">Upload Everything</button>
</div>
<input type="file" id="file-chooser" />
<div id="results"></div>
<div id="fb-root"></div>
<button id="upload-button">Upload to S3</button>
</div>
<script>
alert(getWord());
</script>
The highlighted line is my reference to the javascript file. When I use a tag and try to use my function: "getWord()" in html, nothing happens. I have tested things out and found out that html does not like the words "import" and "@import". I need these keywords in my javascript file though.
My question is how do I access my javascript file when it uses @import?