# Javascript: Key Detection

**URL:** <https://forum.kirupa.com/t/javascript-key-detection/182141>\
**Category:** web dev\
**Created:** [March 15, 2006, 7:22pm UTC](https://forum.kirupa.com/t/javascript-key-detection/182141 "2006-03-15T19:22:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sammo](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sammo/32/779_2.png) [@Sammo](https://forum.kirupa.com/u/Sammo)\
**Post date:** [March 15, 2006, 7:22pm UTC](https://forum.kirupa.com/t/javascript-key-detection/182141/1 "2006-03-15T19:22:27Z")

</div>

I have a function that is called on the onkeyup event for a textarea:

```auto
lArea.onkeyup = updateLivePreview;

```

in my updateLivePreview function I need to check if the key that was released was infact the Enter button, if so do x else do y. How would I acheive this?
