I have a question about JavaScript

I’m in a coding sandbox, attempting to create a project where people can come and draw whatever they like. But I can’t figure out how to bring the white rectangle that is the users’ art canvas to the front in case they want to erase what they’ve drawn. I know I want it to happen at the click of the A key. Is that possible? Thanks!

I really don’t understand what you are trying to do but if you want to fire a keyboard event when you press a key, it’s possible.

KeyboardEvent

All right, let me explain a bit more. I’m creating a project using javascript where users can come and draw. I need to know if it is possible to make it so that when the user presses the A button, their drawing is erased. If this is possible, how can I make it so? Thank you for respondng.

Yes, it is possible. I left a link In my first reply.

Okay thanks I’ll look at it.

Okay, so I checked out the page. I just want to say I barely understood a word… I only just started learning HTML two days ago, and I know a fair amount of JavaScript. Nothing else.

It’s okay.

Do you have a logic on how you want to erase the drawing?

I want to bring the canvas (a white rectangle) above the drawing so that is covers it.

I haven’t worked with canvas before.

Do you have your work hosted somewhere for me to look through?

No, not canvas, I mean the users’ art canvas.

Okay. I’ll suggest you host your code somewhere, GitHub maybe.

I use a site called VidCode. I’d have to submit my work for you to see it.

I don’t think I can help without seeing your work.

Okay. My username is the same their as it is here. I’ll submit what I have so far. It’ll be named Draw Whatever You Please.

I submitted it. You should be able to find it.

If you don’t understand much about HTML, I highly recommend looking more into it, as it will help you way more than anyone in the forums could.

Yo, so I might be able to help with the JavaScript issue, but I also don’t quite understand the problem.