0

I have two buttons button-1 and button-2, now what I is that when I hold button-1 and try to click button-2 with second finger it got clicked I tried this but when I hold button-1 I can't click button-2

Here is my code:

<button id="button-1">Button 1</button>
<button id="button-2">Button 2</button>
  • What are you trying to attain whats your goal?maybe you should rephrase your sentences so its more clear. clicking 2 buttons at the same time is possible on script. Let us know how can we help. – Crystal Apr 17 '22 at 06:19
  • I don’t think that’s possible because the moment you click the one button (either manually or through script, click event gets generated of that particular button) but why would you wanna do it anyway? If you want to perform same actions on both of these, you might want to keep a single button anyway. – ABGR Apr 17 '22 at 06:56
  • @Crystal well I am trying to make a mobile game using html canvas and javascript in which one button is for movement and one button is for jump so when I hold first button player start running and then when I click on second button player jump while running i hope you understand what i am trying to say. – dhanesh vaghasiya Apr 17 '22 at 07:40
  • @dhaneshvaghasiya try all the answers here if any will work for you. https://stackoverflow.com/questions/47737404/detecting-left-and-right-mouse-events-for-a-canvas-game or atleast give you an idea on how to execute. – Crystal Apr 17 '22 at 07:54
  • If that doesnt work heres another idea of event clicking both at the same time. https://stackoverflow.com/questions/30040480/how-to-make-an-event-for-left-right-click-at-the-same-time – Crystal Apr 17 '22 at 07:57
  • @Crystal thank's for these links but none of them help me or give any idea but still I find something by myself. – dhanesh vaghasiya Apr 17 '22 at 13:12
  • if you found something please post the answer so we know how you solved it – Michael Dec 03 '22 at 22:00
  • @ABGR if you are using a touchscreen you could conceivably click several buttons at the same time – Michael Dec 03 '22 at 22:01

0 Answers0