Action Link Sound When Pressed

Hello, we have an action link button that when pressed sends an email. I’d like add a script that when the action link button is pressed, a sound is made. Below is a script that @Sunny_Singla created for when a user presses submit button a sound is played.

$(document).on(‘knack-form-submit.view_21’, function (event, view, data) { // Login Page to Redirect
var audio = new Audio(‘https://cdn.pixabay.com/download/audio/2022/03/16/audio_492840191c.mp3’);
audio.play();
});

I’ve tried to implement this script into the action link button with various changes with NO LUCK.

Any an all help is appreciated… JON

1 Like

Hi Jon1, ¿you got it?, i wish do the same action.

The trouble was in the (‘), the correct character is (').
:slight_smile:

Hello Jon, Bruno,

check “Knack” page and click action link and when you click on sound it will play sound after action.

below is the code
// Acion link sound
var isactionpressed=0;
$(document).on(‘knack-view-render.view_179’, function (event, view, records) {
if(isactionpressed==1)
{
var audio = new Audio(“https://cdn.pixabay.com/download/audio/2022/03/16/audio_492840191c.mp3”);
audio.play();
}
isactionpressed=0;
});

$(“#view_179 .col-2 a”).live(“click”,function(){
isactionpressed=1;
});

Change view id and col-2 according to your view and column number

Regards,
Sunny Singla
ssingla1985@gmail.com
+919855089359

1 Like

Hi @Gerardo_Bruno

This happens a lot if code isn’t posted as code in the forum. When copying code always check the quotation marks are correct. The first time I did it, it took quite a while to figure out.

I would suggest copying code into vsCode or other JavaScript editor first.

Craig

Thanks Sunny!!

Yes!, thank you Craig