title: The value of input element changes but not shown in the browser(s)?
body: <p>I wrote a live search field for a part of my form, when the suggestions come and user clicks on one of them, a <code>js</code> function (<code>selectedService</code>) is being called to get the <code>innerHTML</code> of the <code>li</code> which the user clicked on!
  everything works perfectly when you look at the code in 'Inspect Element' of the browser, but not on the web page!</p>
  
  <p>after the user clicks on the on the suggestion the value property of input element changes in the code but on the browser. the content of input field is still what the user is typing in it.</p>
  
  <p>here's the code :</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html dir="rtl"&gt;
  &lt;head&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;input value="" id="services" placeholder="click or type plz..."/&gt;
  &lt;ul id="suggestions"&gt;
  &lt;/ul&gt;
  &lt;style&gt;
      /* some styles */
  &lt;/style&gt;
  &lt;script&gt;
  var input = document.getElementById("services");
  var suggestions = document.getElementById("suggestions");
  
  input.oninput = function() {
      var q = input.value;
  
      if (q.length &lt; 2) {
          suggestions.setAttribute("style","display: none");
          return;
      }
      var xhr2 = new XMLHttpRequest;
      xhr2.open("GET", "theURL/service-request-handler.php?q="+q, true);
      xhr2.onreadystatechange = function() {
          if (xhr2.readyState == 4 &amp;&amp; xhr2.status == 200)
          {
              var result = xhr2.responseText;
              console.log("server response = "+result);
              var json = JSON.parse(result);
              showSuggestions(json);
          }
      };
      xhr2.send();
  };
  
  function showSuggestions(json) {
      suggestions.setAttribute("style","display: block");
      var li_list = '';
      var i = 0;
      for (i=0; i&lt;json.length; i++) 
          li_list += '&lt;li id="'+i+'" onclick="selectedService('+i+')"&gt;'+json[i]+'&lt;/li&gt;';
  
      suggestions.innerHTML = li_list;
  }
  
  function selectedService(i) {
      li_target = document.getElementById(i);
      console.log(li_target.innerHTML);
  //    input.innerHTML = li_target.innerHTML;
      input.setAttribute("value",li_target.innerHTML);
      suggestions.setAttribute("style","display: none");
  }
  
  
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>the result in the Inspect Element : 
  <a href="https://i.stack.imgur.com/UeiGc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UeiGc.png" alt="before onclick event"></a></p>
  
  <p><a href="https://i.stack.imgur.com/IR9BN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IR9BN.png" alt="when event happens!"></a></p>
  
  <p>I'd appreciate any help or suggestions :)</p>