Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

174
Views
how to stop button play when click to play another button in elementor

im using wordpress with elementor i created multiple buttons that when clicked play a sound effect but my problem is when 1 button clicked and at the same time when button 1 playing if i clicked the button 2 also will play along side with button 1 how to make andy button to stop play when other is clicked ? *im using the following code to play button

<script>
$(document).ready(function() {
  //Audio 1 Starts
  var audio1 = new Audio('Sound-Effect-URL')
  $(".button-class").mousedown(function() {
    audio1.load();
    audio1.play();
  });
  //Audio 1 Ends
});
</script>```
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you have both buttons code's on the same script you can try this:

<script>
$(document).ready(function() {
  //Audio 1 Starts
  var audio1 = new Audio('Sound-Effect-URL')
  var audio2 = new Audio('Sound-Effect-URL2')
  $(".button-class").mousedown(function() {

    audio2.pause();
    audio2.currentTime = 0;

    audio1.load();
    audio1.play();
  });
  //Audio 1 Ends
$(".button-class2").mousedown(function() {

    audio1.pause();
    audio1.currentTime = 0;

    audio2.load();
    audio2.play();
  });
});
</script>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!