javascript - Alternative logical operator for more than two inputs with check value -
i have script in js:
<script> $(document).ready(function () { $('#new_logo_box').click(function (event) { if (this.checked) { $('#basic_info').slidedown(400); } else { $('#basic_info').slideup(400);} }); }); </script>
now want check more 1 input alternative logical operator. how should that? trying with:
<script> $(document).ready(function () { $('#new_logo_box').click(function (event) || $('#renew_logo_box').click(function (event) { if (this.checked) { $('#basic_info').slidedown(400); } else { $('#basic_info').slideup(400);} }); }); </script>
but not working...
you can select each element separately , use add
add event listener both of them:
var newlogobox = $('#new_logo_box'); var renewlogobox = $('#renew_logo_box'); newlogobox.add(renewlogobox).on('change', function () { if (newlogobox.prop('checked') || renewlogobox.prop('checked')) { $('#basic_info').slidedown(400); } else { $('#basic_info').slideup(400); } });
Comments
Post a Comment