/ 设置 10 秒超时 // 每日统计清 0 runtime_set('todaycomments', 0); runtime_set('todayarticles', 0); runtime_set('todayusers', 0); if ($forumlist) { $fidarr = array(); foreach ($forumlist as $fid => $forum) { $fidarr[] = $forum['fid']; } forum_update($fidarr, array('todayposts' => 0, 'todaythreads' => 0)); } // 清理临时附件 attach_gc(); // 当天24点 $today = strtotime(date('Ymd')) + 86400; runtime_set('cron_2_last_date', $today, TRUE); // 往前推8个小时,尽量保证在前一天 升级过来和采集的数据会很卡 // table_day_cron($time - 8 * 3600); cache_delete('cron_lock_2'); } } } ?>woocommerce offtopic - select2 & selectWoo Not Loading Options|Concepts Of Algorithm

woocommerce offtopic - select2 & selectWoo Not Loading Options

admin2025-01-08  8

I created a custom select checkout field and the field works great. When I add a selectWoo or a select2 class to it, it functions like a select2 box but says no results found. The html options are there.

Does select2 or selectWoo not work for a custom field, or did I do something wrong?

Field is:

woocommerce_form_field( 'student_name', array(
    'type'          => 'select',
    'class'         => array('my-field-class form-row-wide ram_select2'),
    'label'         => __('Student'),
    'placeholder'   => __('Student Name'),
    'required'      => true,
    'options'       => $patients,
    ), $checkout->get_value( 'student_name' ));

I initiated the class in an enqueued js script:

(function($) {
$(document).ready(function() {
$('.ram_select2').selectWoo();
});
})(jQuery);

I created a custom select checkout field and the field works great. When I add a selectWoo or a select2 class to it, it functions like a select2 box but says no results found. The html options are there.

Does select2 or selectWoo not work for a custom field, or did I do something wrong?

Field is:

woocommerce_form_field( 'student_name', array(
    'type'          => 'select',
    'class'         => array('my-field-class form-row-wide ram_select2'),
    'label'         => __('Student'),
    'placeholder'   => __('Student Name'),
    'required'      => true,
    'options'       => $patients,
    ), $checkout->get_value( 'student_name' ));

I initiated the class in an enqueued js script:

(function($) {
$(document).ready(function() {
$('.ram_select2').selectWoo();
});
})(jQuery);
Share Improve this question asked Jan 7, 2020 at 20:06 Dan W.Dan W. 234 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Try this way:

woocommerce_form_field( 'student_name', array(
'type'          => 'select',
'class'         => array('my-field-class','form-row-wide','ram_select2'),
'label'         => __('Student'),
'placeholder'   => __('Student Name'),
'required'      => true,
'options'       => $patients,
), $checkout->get_value( 'student_name' ));
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736269214a1334.html

最新回复(0)