# Double click ENTER

**URL:** <https://phaser.discourse.group/t/double-click-enter/7107>\
**Category:** Phaser 3\
**Created:** [August 5, 2020, 11:47am UTC](https://phaser.discourse.group/t/double-click-enter/7107 "2020-08-05T11:47:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Felicia\_Debye](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/felicia_debye/32/3220_2.png) [@Felicia\_Debye](https://phaser.discourse.group/u/Felicia_Debye)\
**Post date:** [August 5, 2020, 11:47am UTC](https://phaser.discourse.group/t/double-click-enter/7107/1 "2020-08-05T11:47:26Z")

</div>

Hi,

i would like to have an event by clicking enter once and an other event by clicking enter twice.  
It looks like this:

```
//close info texts with ENTER		
		if(close_btn.visible){
			this.input.keyboard.once("keydown-" + "ENTER", () => {
				buttonAudio.play();
				fInfoGroup.setVisible(false);
				if(infoteam_EG.visible){
					fSpotsGroup_EG.setVisible(true);
					fSpotsGroup_1OG.setVisible(false);
					fSpotsGroup_2OG.setVisible(false);
				} else if (infoteam_1OG.visible) {
					fSpotsGroup_EG.setVisible(false);
					fSpotsGroup_1OG.setVisible(true);
					fSpotsGroup_2OG.setVisible(false);
				} else if(infoteam_2OG.visible) {
					fSpotsGroup_EG.setVisible(false);
					fSpotsGroup_1OG.setVisible(false);
					fSpotsGroup_2OG.setVisible(true);
				} else {
					return;
				}
				close_btn.setVisible(false);
				tutor.setVisible(false);
			});
		}
		
		let lastTime = 0;
		this.input.keyboard.on("keydown-" + "ENTER", ()=>{
    		let clickDelay = this.time.now - lastTime;
   			lastTime = this.time.now;
   			if(clickDelay < 350) {
				this.scene.start("Instructions");	
    		}
		});

```

It general works but when i press ENTER too long it also acts like its double click.  
Can i proof if the key is really pressed twice and not once but a longer time?

Thanks!

---

<div class="post-metadata">

**Author:** ![BlunT76](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/blunt76/32/1454_2.png) [@BlunT76](https://phaser.discourse.group/u/BlunT76)\
**Post date:** [August 5, 2020, 2:38pm UTC](https://phaser.discourse.group/t/double-click-enter/7107/2 "2020-08-05T14:38:14Z")

</div>

Try with keyup instead of keydown, so event works only when you press And leave the enter key
