# How to auto set username value in input place?

**URL:** https://meta.discourse.org/t/how-to-auto-set-username-value-in-input-place/230478
**Category:** Development
**Created:** [June 20, 2022, 1:56pm UTC](https://meta.discourse.org/t/how-to-auto-set-username-value-in-input-place/230478 "2022-06-20T13:56:47Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![DragonByte](https://avatars.discourse-cdn.com/v4/letter/d/41988e/32.png) [@DragonByte](https://meta.discourse.org/u/DragonByte)
#### Post date: [June 20, 2022, 1:56pm UTC](https://meta.discourse.org/t/how-to-auto-set-username-value-in-input-place/230478/1 "2022-06-20T13:56:48Z")

</div>

Hello!

I found this script to show username in text banner: [Display username when login in banner - #10 by tshenry](https://meta.discourse.org/t/display-username-when-login-in-banner/83024/10)

```plaintext
<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>

```

```plaintext
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:

```plaintext
<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 🥺
