-1

For a simple two buttons like those

<button id="right" type="button">SWIPE RIGHT</button>
<button id="left" type="button">SWIPE LEFT</button>

How can i use JQuery or JavaScript to trigger a click on a button document.getElementById('#id').click(); When i swipe left or right.

And is that possible using PHP?

Calibur Victorious
  • 638
  • 1
  • 6
  • 20

2 Answers2

2

Your code is a mix of JS an jQuery. It should be either of the below:

// Native:
document.getElementById('id').click();

// jQuery:
$('#id').click();

And is that possible using PHP?

No. PHP runs on the server and has no bearing on client events.

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
1

You can trigger the click event usiong the jQuery trigger function like this:

$('#id').trigger('click');
Hulothe
  • 744
  • 1
  • 5
  • 17