# mousePressed not working? or something else?

**URL:** <https://discourse.processing.org/t/mousepressed-not-working-or-something-else/2848>\
**Category:** Processing\
**Created:** [August 22, 2018, 12:39pm UTC](https://discourse.processing.org/t/mousepressed-not-working-or-something-else/2848 "2018-08-22T12:39:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdeepak](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@mdeepak](https://discourse.processing.org/u/mdeepak)\
**Post date:** [August 22, 2018, 12:39pm UTC](https://discourse.processing.org/t/mousepressed-not-working-or-something-else/2848/1 "2018-08-22T12:39:02Z")

</div>

if(!mousePressed){  
ellipse(width/2, height/2,100,100);  
} else {  
rect(width/2, height/2,100,100);  
}

error: mousePressed is not defined  
I have referenced to p5.js, p5.sound.js and p5.dom.js in my index.html. What is going on here?

---

<div class="post-metadata">

**Author:** ![TheWizardBear](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/thewizardbear/32/3552_2.png) [@TheWizardBear](https://discourse.processing.org/u/TheWizardBear)\
**Post date:** [August 22, 2018, 12:44pm UTC](https://discourse.processing.org/t/mousepressed-not-working-or-something-else/2848/2 "2018-08-22T12:44:18Z")

</div>

In p5.js, it is mouseIsPressed, whereas in Processing it is mousePressed.

Also, format your code using the \</\> button and make sure you categorise it as p5 not Processing.

---

<div class="post-metadata">

**Author:** ![mdeepak](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@mdeepak](https://discourse.processing.org/u/mdeepak)\
**Post date:** [August 22, 2018, 1:11pm UTC](https://discourse.processing.org/t/mousepressed-not-working-or-something-else/2848/3 "2018-08-22T13:11:24Z")

</div>

It works. Thanks. I guess I was watching processing tuts on utube by Shiffman and working on p5js on my laptop. That’s where things got mixed up.
