Live Edit Getting changes in index.html but javascript not called.
I have the following files:
Index.html
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="winner-box">
<div class="winner-text">And the winner is...
<span class="winner-name">???</span>
</div>
</div>
<script src="winner.js"></script>
</body>
</html>
style.css
winner-box {
height: 100vh;
background: #de4b4f;
display: flex;
justify-content: center;
align-items: center;
font-size: 30px;
}
.winner-text {
color: rgba(255,255,255,0.6);
font-family: 'Fira Sans', sans-serif;
font-width: 400;
-webkit-font-smoothing: antialiased;
letter-spacing: 1px;
}
.winner-name {
font-width: 800;
color: white;
display: inline-block;
border: 5px solid white;
padding: 0.3em 0.8em;
margin-left: 5px;
font-size: 2em;
letter-spacing: 3px;
}
winner.js
var DevTippers = [
'Adam Rasheed',
'Alexander Barakhov',
'Ayoub Moutil',
'Bharat Modi',
'Bryan Knight',
'Chris D',
'Daniyaal Khan',
'David Vazquez',
'David Farrell',
'Finley',
'Flores Kire',
'Goran Petricevic',
'Guillaume Bauer',
'Hamza Shezad'
];
// generate a random number
function winner(min, max) {
return Math.floor(Math.random()*(max-min)+min);
}
//console.log(winner(10, 0));
// apply random number
document.querySelector('.winner-name').innerHTML = DevTippers[winner(0, DevTippers.length)];
I have installed and enabled LiveEdit.
When it first runs debug, it works fine, but as I make changes in the index.html the '???' is not getting replaced by the line in the winner.js file. What have I missed with the configuration of liveedit?
请先登录再写评论。
Live Edit doesn't force execution of javascript code that is run on page load. So you need to manually reload the page to see the new code execution result
Thank you, I thought I might have missed some setting.