nayeem101 / form-input-autosuggest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

form-input-autosuggest

This is a simple form input auto suggestion boilterplate/template

This can be used with any backend api or can be used in server side rendering after some little tweaks


Where to make change?

  • In index.html <form action="/data" method="get" autocomplete="off" class="search-form"> change the action attribute with your API endpoint

  • In autoSugest.js async function searchBook(searchText) { let url = "/data.json"; change the url with your API endpoint

  • In autoSugest.js

    function showSuggestion(arr) {
          //other codes
        b.addEventListener("click", function (e) {
            ...
            form.action = "/data/" + id;
            ...
        }
        //other codes
      }
    
  • change form.action with your API endpoint

About


Languages

Language:JavaScript 69.7%Language:CSS 19.4%Language:HTML 10.9%