How to auto set username value in input place?

Hello!

I found this script to show username in text banner: Display username when login in banner - #10 by tshenry

<script type="text/discourse-plugin" version="0.8.18">
    api.onPageChange(() => {
        if(api.getCurrentUser() != null) {
            $("#logged-in-user").text(" " + api.getCurrentUser().name.split(' ')[0]);
        }
    });
</script>
Hello, <span id="logged-in-user"></span>!

I need to create custom form and auto set user username value in input place, I try add <span id="logged-in-user"></span> in value, but it’s not work, my code:

<input type="text" id="username" placeholder="@username" value="logged-in-user"/>
<input type="text" id="city" placeholder="City" value=""/>

<button id="Send">Send PM</button>

And after click Send button I need add value username and city to link in action button.

Please help :pleading_face: