Access the value of the textarea element.

<html>
<body>
<img id="profilePic" src="https://mimo.app/r/profile.png" height="48">
<textarea id="messageInput" rows="3" cols="18" placeholder="New Message"></textarea><br>
<button onclick="share()">Share</button>
  <script>function share() {
var message = document.getElementById("messageInput").value;
}</script>
</body>
</html>]]>

Make sure to assemble document.getElementById("messageInput").value.