A
A
Anton2018-01-31 03:20:12
JavaScript
Anton, 2018-01-31 03:20:12

How to perform a checkbox action?

Put a tick - the thread should play, uncheck it - the thread stops.
began to sketch out the code, something does not work out

<input type="checkbox" name="qcID" id="qcID1" value="1">
<label for="qcID1">галочка стоит поет - не стоит не поет</label>

<script src='http://code.jquery.com/jquery-latest.js'></script>
<script>
$("input:checkbox").on("checked", function() {
    beep();          
});
var beep = (function () {
   var snd = new Audio("http://music.test.ru:8000/play"); 
   snd.play();
});
</script>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2018-01-31
@Stalker_RED

Not "checked" but "change"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question