Поддержка Поиск специалистов Заменить checkbox на select

  • Здравствуйте,
    В фильтре поиска используется блок с checkboxes, выбрав один из критериев происходит поиск. Поскольку checkboxвариантов достаточно много, нужно заменить его на выпадающий список select list.
    Чтобы при выборе option происходил поиск.
    Вот пример базового кода:

    <div class="one_half first">
    
    									<span class="filters-subtitle"><?php _e( 'Job Types', 'themesdojo' ); ?></span>
    
    									<ul class="filters-lists">
    
    										<li class="filters-list-all <?php if(empty($job_type)) { ?>active<?php }?>">
    											<i class="fa fa-square-o"></i><i class="fa fa-check-square"></i><?php _e( 'All Types', 'themesdojo' ); ?>
    											<input type="hidden" class="job_presence_type_option" name="job_presence_type_all" value="<?php if(empty($job_type)) { ?>1<?php }?>" />
    										</li>
    
    										<?php
    											global $redux_demo;
    											for ($i = 0; $i < count($redux_demo['job-type']); $i++) {
    										?>
    
    										<li class="filters-list-one <?php if($job_type == $redux_demo['job-type'][$i] ) { ?>active<?php } ?>">
    											<i id="job-type[<?php echo $i; ?>]" class="fa fa-square-o"></i><i class="fa fa-check-square"></i><?php echo $redux_demo['job-type'][$i]; ?>
    											<input type="hidden" class="job_presence_type_option_value" name="job_presence_type_value[<?php echo $i; ?>]" value="<?php echo $redux_demo['job-type'][$i]; ?>" />
    											<input type="hidden" class="job_presence_type_option" name="job_presence_type[<?php echo $i; ?>]" value="<?php if($job_type == $redux_demo['job-type'][$i] ) { echo $redux_demo['job-type'][$i]; } ?>" />
    										</li>
    
    										<?php
    											}
    										?>
    
    									</ul>
    
    								</div>

    кусок js

    jQuery(document).on("click","ul.filters-lists li.filters-list-one",function(e){
    
                                    jQuery('#companies_current_page').val('1');
                                     if (jQuery(this).hasClass('active')) {
    
                                        jQuery(this).removeClass('active');
                                        jQuery(this).find('.job_presence_type_option').val('');
    
                                        $.fn.wpjobusSubmitFormFunction();
                                        $.fn.wpjobusSubmitFormMapFunction();
    
                                        e.preventDefault();
                                        return false;
    
                                    } else {
    
                                           jQuery(this).addClass('active');
                                           var id = jQuery(this).find('.job_presence_type_option_value').val();
                                           jQuery(this).find('.job_presence_type_option').val(id);
                                           jQuery(this).parent().find('.filters-list-all').removeClass('active');
                                           jQuery(this).parent().find('.filters-list-all .job_presence_type_option').val('');
    
                                           $.fn.wpjobusSubmitFormFunction();
                                           $.fn.wpjobusSubmitFormMapFunction();
    
                                           e.preventDefault();
                                        return false;
    
                                   }
    
                                });
    
                                jQuery(document).on("click","ul.filters-lists li.filters-list-all",function(e){
    
                                     if (jQuery(this).hasClass('active')) {
                                        jQuery(this).removeClass('active');
                                        jQuery(this).find('.job_presence_type_option').val('');
                                    } else {
    
                                        jQuery('#companies_current_page').val('1');
    
                                           jQuery(this).addClass('active');
                                           jQuery(this).find('.job_presence_type_option').val('1');
                                           jQuery(this).parent().find('.filters-list-one').removeClass('active');
                                           jQuery(this).parent().find('.filters-list-one .job_presence_type_option').val('');
    
                                           $.fn.wpjobusSubmitFormFunction();
                                           $.fn.wpjobusSubmitFormMapFunction();
    
                                           e.preventDefault();
                                        return false;
    
                                    }
                                });
Просмотр 1 ответа (всего 1)
Просмотр 1 ответа (всего 1)
  • Тема «Заменить checkbox на select» закрыта для новых ответов.