使用 jquery-ui spinner 时出现问题。
使用ID时可以正常工作。 但对于在 foreach 语句中使用, 我必须使用该类。
但是,当使用类时它不起作用。 你知道问题出在哪里吗?
我的 jquery ui 版本:
1.12.1/jquery-ui.js
jQuery(document).ready(function(){
jQuery( "#spinner" or ".spinner" ).spinner();
});
“#spinner”仅有效。 “.spinner”不起作用。 不知道有什么区别。
开发者也有一个微调器。 但是,Spinner 的文本输入表单、向上或向下按钮都不起作用。 并且控制台中没有错误。
================================================== =
function get_group_setting() {
$get_section = get_post_meta( get_the_ID(), 'group_setting');
if ( $get_section ) {
echo '<form class="form_group">
<ul>';
foreach ($get_section as $field) {
$values = explode( ' | ', $field );
echo '<li><input type="radio" value="' . $values[2] .' " name="select_group" />' . $values[0] . ', ' . $values[1] . ', ' . $values[2] . ' <input class="spinner" name="value_1"></li>';
}
echo '
</ul>
</form>';
}
}
为每个语句添加我的。 谢谢。
最佳答案
您需要使用以下代码来使其运行:
对于 ID 和类:
jQuery(document).ready(function(){
jQuery( "#spinner, .spinner" ).spinner();
});
对于 ID:
jQuery(document).ready(function(){
jQuery( "#spinner" ).spinner();
});
对于类(class):
jQuery(document).ready(function(){
jQuery( ".spinner" ).spinner();
});
关于jquery ui spinner 在使用类时不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55798674/