Reputation: 3
Visual studio won't update the project when I change something in a javascript file that is the source of an html file. This happens almost all the time.Very rarely does it update right away when I make changes, rebuild, and debug.
I have a cshtml file in my View folder that has a
<button id="SaveButton" onclick="SaveNExit()" type="button">Save & Exit </button>
along with <script src="~/js/Index.js"></script>
in the cshtml page.
I have the Index.js file with the function it it
function SaveNExit() {
document.getElementById("SaveButton").disabled = true;
}
--This works when I click it, it fades out or is disabled. Then I do this (add an alert message):
function SaveNExit() {
document.getElementById("SaveButton").disabled = true;
alert("Your form was saved");
}
-- I rebuild the solution and debug. I click the button. The button fades-out/disables just like before, but the alert message doesn't pop up.
I tried cleaning and rebuilding solution, I tried restarting Visual Studio, and I tried restarting my computer. Nothing works. It works after over night where I turn off my computer for about 9 hours and turn it back on the next day. Any idea why?
Upvotes: 0
Views: 1510
Reputation: 1665
Upvotes: 0
Reputation: 4570
Surely a problem is js file is caching.Do CTRL + F5 and then check.If the problem still occured you must clear the whole browser cache.
Upvotes: 2