Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to load the chosen library: http://harvesthq.github.com/chosen/

I am enqueuing a .js file as below:

wp_register_script( 'js_custom', plugin_dir_url( __FILE__ ) . 'js/jquery.js', false );
wp_enqueue_script ( 'js_custom' );

Inside the .js file I loading chosen like this:


But I keep getting this error:

TypeError: Result of expression 'jQuery(".chosen").chosen' [undefined] is not a function.

share|improve this question
What is in js/jquery.js? –  s_ha_dum Feb 13 '13 at 23:28

1 Answer 1

You forgot to load chosen library:

wp_register_script( 'js_chosen', 'https://raw.github.com/harvesthq/chosen/master/chosen/chosen.jquery.js', array('jquery') );
wp_register_script( 'js_custom', plugin_dir_url( __FILE__ ) . 'js/jquery.js', array('jquery', 'js_chosen') );
wp_enqueue_script ( 'js_custom' );
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.