I am currently in the process of developing a webpage where, upon clicking a button, all elements within an HTML element are deleted and replaced with an iframe. However, I have encountered some issues as my code does not seem to be functioning properly. index.html:
<html id="html">
<head>
<script type="text/javascript" src="/freevpn/script.js"></script>
</head>
<body>
<input type="text" id="input" value="https://">
<button onclick="submit()">Go!</button>
</body>
</html>
script.js:
function submit() {
var submit = document.getElementById("submit");
var input = document.getElementById("input");
var iframe = document.createElement("iframe");
var html = document.getElementById("html");
iframe.setAttribute("src", input.value);
html.innerHTML = "";
html.appendChild(iframe);
iframe.requestFullscreen();
}
I am unsure why this functionality is not working as intended, but I believe there must be a solution. Any help would be greatly appreciated!
UPDATE: After troubleshooting, I identified a few issues such as linking problems with the JavaScript file, fixing the function, and ensuring all necessary parentheses were added. Despite making these updates, I am still unable to see any changes reflected on my webpage after clearing my cache. My website is integrated with Freenom, Cloudflare, Google Analytics, and Search Console - could this integration be delaying the update process? If so, is there a way to expedite this update?