I need to simulate a mouse click on a radio button,but the button is only selected. How do I make functions work for a case?
$("input[value='0']").click();
$('input[name=level]').on('click', function(event) {
switch ($(this).val()) {
case '0':
alert("zero");
break;
case '1':
alert("one");
break;
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<label>
1<input type="radio" class="option-input radio" checked value="1" name="level" />
0<input type="radio" class="option-input radio" value="0" name="level" />
</label>