admin管理员组文章数量:1336659
Although I have imported materialize.js (v1.0.0) inside my plugin in WordPress with
$pluginpath = dirname (plugin_dir_url( __DIR__ ));
$pluginpath = str_replace('\\','/',$pluginpath);
$thepath = $pluginpath . '/js_libs/materialize.js';
wp_enqueue_script('wpunity_materialize_jslib', $thepath);
and in my main function
wp_register_script( 'wpunity_materialize_jslib', plugin_dir_url( __FILE__ ) . 'js_libs/materialize.js', null, null, false);
I keep getting
jQuery(...).material_chip is not a function
for this code
<div id="textarea-collaborators" class="chips-autocomplete"></div>
<script>
jQuery( document ).ready(function() {
jQuery('.chips-autocomplete').material_chip({
secondaryPlaceholder: 'Your collaborator email',
placeholder: 'Your collaborator email'
});
});
</script>
Although I have imported materialize.js (v1.0.0) inside my plugin in WordPress with
$pluginpath = dirname (plugin_dir_url( __DIR__ ));
$pluginpath = str_replace('\\','/',$pluginpath);
$thepath = $pluginpath . '/js_libs/materialize.js';
wp_enqueue_script('wpunity_materialize_jslib', $thepath);
and in my main function
wp_register_script( 'wpunity_materialize_jslib', plugin_dir_url( __FILE__ ) . 'js_libs/materialize.js', null, null, false);
I keep getting
jQuery(...).material_chip is not a function
for this code
<div id="textarea-collaborators" class="chips-autocomplete"></div>
<script>
jQuery( document ).ready(function() {
jQuery('.chips-autocomplete').material_chip({
secondaryPlaceholder: 'Your collaborator email',
placeholder: 'Your collaborator email'
});
});
</script>
Share
Improve this question
asked May 19, 2020 at 10:37
Dimitrios VerveridisDimitrios Ververidis
1426 bronze badges
1 Answer
Reset to default 0I found it.
wp_enqueue_script('wpunity_materialize_jslib', $thepath);
has to be called last, after all other calls to enqueue scripts that invoke jQuery.
SOLVED
本文标签: front endHow to use jQuery()materialchip inside WordPress
版权声明:本文标题:front end - How to use jQuery(...).material_chip inside WordPress? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742420504a2471562.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论