1234567891011121314151617181920212223242526272829303132 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title id="page-title">HTMX Demos</title>
- <script src="htmx-1-9-12.min.js"></script>
- <link rel="stylesheet" href="styles.css"/>
- <script>
- function getCurrentState() {
- return "California";
- }
- </script>
- </head>
- <body>
- <h1 id="title">Demo</h1>
- <h2>Including JavaScript values with <code>hx-vals</code></h2>
- <nav hx-get="/autonum/nav" hx-trigger="load"></nav>
- <div id="main">
- <label for="search">Search Contacts:</label>
- <input id="search" name="q" type="search" placeholder="Search Contacts">
- <button hx-get="/search"
- hx-target="#main .results"
- hx-include="#search"
- hx-vals='js:{"state":getCurrentState()}'>
- Search The Contacts
- </button>
- <div class="results"></div>
- </div>
- </body>
- </html>
|