选择2并选择不加载选项

时间:2020-01-07 作者:Dan W.

我创建了一个自定义的select checkout字段,该字段非常有效。当我向其添加selectWoo或select2类时,它的功能类似于select2框,但表示找不到结果。html选项就在那里。

select2或selectWoo是否不适用于自定义字段,或者我是否做错了什么?

字段为:

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\' ));
我在排队的js脚本中启动了该类:

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

1 个回复
SO网友:Marco Lisei

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\' ));

相关推荐