# How to give suggestions in input box?

**URL:** <https://discourse.processing.org/t/how-to-give-suggestions-in-input-box/11492>\
**Category:** Coding Questions\
**Created:** [May 22, 2019, 12:35pm UTC](https://discourse.processing.org/t/how-to-give-suggestions-in-input-box/11492 "2019-05-22T12:35:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![CodeTime](https://avatars.discourse-cdn.com/v4/letter/c/71e660/32.png) [@CodeTime](https://discourse.processing.org/u/CodeTime)\
**Post date:** [May 22, 2019, 12:35pm UTC](https://discourse.processing.org/t/how-to-give-suggestions-in-input-box/11492/1 "2019-05-22T12:35:29Z")

</div>

I have created an input box where a user can type and I do things later on with what they type in. I was wondering if there was any way in p5.js to put grey text in the input box to “suggest” what the user is to type in, like your first, last name and so on, which should also disappear when they start typing.

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [May 22, 2019, 1:29pm UTC](https://discourse.processing.org/t/how-to-give-suggestions-in-input-box/11492/2 "2019-05-22T13:29:54Z")

</div>

it is not what you asked for, but might be usable:

```auto
var question = 'your name?';

function setup() {
  createCanvas(300, 200);
  background(200,200,0);
  var qtest = createElement('p', question);
  qtest.position(10,7);
  var inp = createInput();
  inp.position(100,20);
  inp.input(myInputEvent);
}

function myInputEvent() { 
  console.log('you are typing: ', this.value());
}

```

![SNAG-0115](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/1/1316565528f4e163485fe2f45882a8e591bcc6b7.jpeg)

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [May 22, 2019, 1:48pm UTC](https://discourse.processing.org/t/how-to-give-suggestions-in-input-box/11492/3 "2019-05-22T13:48:33Z")

</div>

> [@CodeTime](#):
>
> … any way in p5.js to put grey text in the input box to “suggest” what the user is to type in,

```java
let inp;

function setup() {
  inp = createInput().attribute('placeholder', 'hint');
}

```

> **[reference | p5.js](https://p5js.org/reference/#/p5/createInput)**
>
> p5.js a JS client-side library for creating graphic and interactive experiences, based on the core principles of Processing.

> **[reference | p5.js](https://p5js.org/reference/#/p5.Element/attribute)**
>
> p5.js a JS client-side library for creating graphic and interactive experiences, based on the core principles of Processing.

> **[\- HTML: HyperText Markup Language | MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/text#Setting_placeholders)**
>
> elements of type text create basic single-line text fields.

---

<div class="post-metadata">

**Author:** ![CodeTime](https://avatars.discourse-cdn.com/v4/letter/c/71e660/32.png) [@CodeTime](https://discourse.processing.org/u/CodeTime)\
**Post date:** [May 22, 2019, 2:27pm UTC](https://discourse.processing.org/t/how-to-give-suggestions-in-input-box/11492/4 "2019-05-22T14:27:20Z")

</div>

thank you very much for the help
