Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

normal javascript functions that htmx would just call:

<button hx-post="/api/data" hx-swap="outerHTML" hx-trigger="click" hx-ext="localStorageHandler">Save Data</button>

<script> function localStorageHandler(element) { // Get the input value const inputValue = document.getElementById('inputField').value;

    // Save the value to localStorage
    localStorage.setItem('myData', inputValue);
  }
</script>


Ok cool thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: