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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -