-5
I need to turn down the volume of <audio>
by clicking the arrow below, but the if
is not working, never gets into the else
. Why?
Code:
$(document).keyup(function(e) {
if (e.keyCode == 40) {
if ($("#nome").get(0).volume = 0.1)
{
$("#nome").prop('muted', true);
}
else if ($("#nome").get(0).volume = 0.4)
{
$("#nome").prop("volume", 0.1);
}
}
});
Why are you negatively asking the question, why ?
– user6026
@Fulvius I think it is because the problem seems to have been caused by a distraction (see correct use of
==
in theif
outsider).– bfavaretto
I agree with you @bfavaretto of the error, that’s it, but the intention is not to point out the errors? Or not?
– user6026
@Fulvius One of the main goals of the site is to be a great repository of questions and answers, ideally useful for more than one person. So the more chance the question has of serving future visitors, who arrive here by Google, the better. In this sense, syntax errors like this are not good candidates. I edited the title with this in mind.
– bfavaretto
Got it @bfavaretto
– user6026
It’s time to mark the question as resolved
– Wallace Maxters
@Wallacemaxters I’m thinking of closing... but I’m in doubt, because this kind of mistake is up to that common.
– bfavaretto