jquery - How can I use or operator here to make my code shorter? -


i have following code. how can use 'or' operator here make code shorter?

    $(document).ready(function() {           $("#id_event_type_1").click(function(){             $("#id_end_date").show();             $('label[for="id_end_date"]').show();         });     });      $(document).ready(function(){         $("#id_event_type_2").click(function(){             $("#id_end_date").show();             $('label[for="id_end_date"]').show();         });     });      $(document).ready(function() {         $("#id_event_type_3").click(function(){             $("#id_end_date").show();             $('label[for="id_end_date"]').show();         });     }); 

since seem same:

$(document).ready(function() {     $("#id_event_type_1,#id_event_type_2,#id_event_type_3").click(function(){         $("#id_end_date").show();         $('label[for="id_end_date"]').show();     }); }); 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -