title: Vue method scroll div to top
body: <p>I am learning <code>vue</code>. I have the following method where I add a chat message to a div with <code>id="toolbar-chat"</code>. This div allows scrolling on y axis and I would like the div to jump to the top every time a new message is added. Why is my JS not working?</p>
  
  <pre><code>    document.getElementById("toolbar-chat").scrollTop = 0;
  </code></pre>
  
  <p>My <code>vue</code> method:</p>
  
  <pre><code>    methods: {
          addMessage(message) {
              this.messages.unshift(message);
  
              document.getElementById("toolbar-chat").scrollTop = 0;
  
              axios.post(chat_send_route, message)
              .then(response =&gt; {
                  console.log(response.data);
              });
  
          }
      }
  </code></pre>