Using div as a custom button with onclick event I want to be able turn on/off browser “click sound”.
$(".button").click(function(e)
{
if ($(this).attr("disabled") !== "disabled")
{
// my code
}
else
{
e.preventDefault();
}
});
I tried to use preventDefault, but it does not disable sound and browser play “click sound” anyway. How can I manage this default browser feature?
You can’t turn off this sound.
.preventDefault()stops the default action on the button (e.g postback/follow link/etc). The “click sound” is not part of your site but rather a browser/OS feature. You have no control over this.