skip to Main Content

How to append a created html element to another html file?

const button1 = document.getElementById('1'); const button2 = document.getElementById('2'); const main = document.getElementById('main'); function myFunc() { const elem = document.createElement('h1'); button1.onclick = () => { location.assign('2.html'); elem.textContent = '1'; if (location.pathname === '/2.html') { main.appendChild(elem); } } button2.onclick = () =>…

VIEW QUESTION

Javascript – sweetalert and form submit

I have a form and I want to trigger an alert (using sweetalert) on submit: <form id="verbale" class="verbale" action="editor_conferma.php" method="post"> ... <input id="go" type="submit" name="go" value="go" class="swa-confirm"> </form> <script> $(document).on("submit", ".swa-confirm", function (e) { e.preventDefault(); var $myForm = $('.verbale'); if…

VIEW QUESTION
Back To Top
Search