# Create input accept numbers only

**URL:** https://discourse.processing.org/t/create-input-accept-numbers-only/9624
**Category:** Coding Questions
**Created:** [March 26, 2019, 6:09am UTC](https://discourse.processing.org/t/create-input-accept-numbers-only/9624 "2019-03-26T06:09:44Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![d0nk](https://avatars.discourse-cdn.com/v4/letter/d/e9bcb4/32.png) [@d0nk](https://discourse.processing.org/u/d0nk)
#### Post date: [March 26, 2019, 6:09am UTC](https://discourse.processing.org/t/create-input-accept-numbers-only/9624/1 "2019-03-26T06:09:45Z")

</div>

Hello!

I am new to P5js, trying to work with DOM library to accept number as user input. Is there a way to restrict the input box to accept numbers only as input?

---

<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: [March 26, 2019, 9:34am UTC](https://discourse.processing.org/t/create-input-accept-numbers-only/9624/2 "2019-03-26T09:34:30Z")

</div>

i play with “input” and try this:  
[https://editor.p5js.org/kll/sketches/6ggb0\_7uY](https://editor.p5js.org/kll/sketches/6ggb0_7uY)

close to what you need?

---

<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: [March 26, 2019, 10:52am UTC](https://discourse.processing.org/t/create-input-accept-numbers-only/9624/3 "2019-03-26T10:52:08Z")

</div>

[https://Developer.Mozilla.org/en-US/docs/Web/HTML/Element/input/text#Specifying\_a\_pattern](https://Developer.Mozilla.org/en-US/docs/Web/HTML/Element/input/text#Specifying_a_pattern)
