---
# System prepended metadata

title: Untitled

---

- select form, or button or select element, 

- listen for an event - submit, click or change 

- when the event happens, inside the callback function

    **get user input** 
        
        e.target.value (depends on input type)
    
     **get data** 
    - make aonther fetch request to api using user input or use cached data 

    **wipe dom before injecting**
    
        - select element where you want to display 
        - .innerHTML = "" 

   **inject to DOM**

    - (method 1) create new elements,  set innerText, set attributes and append to element where you want to display

    - (method 2) use .innerHTML to inject to dom ```selectedElement.innerHTML = "<p>something</p>"```



