websemantics / Image-Select

Image Select is an extension of Chosen, a jQuery plugin that makes long, unwieldy select boxes much more user-friendly. It provides image support for Single and Multi select HTML tags.
http://websemantics.github.io/Image-Select
MIT License
147 stars 44 forks source link

Cannot read property 'apply' of undefined #31

Closed neillhanna closed 8 years ago

neillhanna commented 8 years ago

Hi I am hoping to use this plugin but I have encountered a problem right off the start.

I get the error that i put for a title when trying to initialize the plugin.

I get this when console logging out the code I use to call "chosen" on

here is my code: console.log(jQuery(".select-with-image")); jQuery(".select-with-image").chosen({ width:"100%", });

Here is the result of console.log(): [select#Suits_Upper_Breast_Pocket.select-with-image, select#Suits_Elbow_Patches.select-with-image, select#Suits_Jacket_Vents.select-with-image, select#Suits_Double_Breasted_Lapel.select-with-image, select#Suits_Single_Breasted_Lapel.select-with-image, select#Suits_Lower_Pocket.select-with-image, select#Suits_Monogram_Options.select-with-image, select#Suits_Jacket_Pick_Stitching.select-with-image, select#Suits_Sleeve_Button_Holes.select-with-image, select#Trousers_Pockets.select-with-image, select#Trousers_Belt_Loop.select-with-image, select#Trousers_Pleat_Style.select-with-image, select#Trousers_Cuff_Style.select-with-image, select#Vests_Collar_Style.select-with-image, select#Vests_Top_collar_use_fabric.select-with-image, select#Vests_Lapel_ingredient_style.select-with-image, select#Vests_Button_style.select-with-image, select#Vests_Lower_pocket_style.select-with-image, select#Vests_Ticket_pocket_style.select-with-image, select#Vests_Back_style.select-with-image, select#Vests_Back_use_fabric_style.select-with-image, select#Vests_Back_lining_using_fabric_style.select-with-image, select#Vests_Back_belt_use_fabric_style.select-with-image, select#Vests_Outside_top_stitch.select-with-image, select#Vests_Button_hole_style.select-with-image, select#Vests_Outside_Pick_stitching_color.select-with-image, select#Shirts_Collar_Styles.select-with-image, select#Shirts_Cuff_Styles.select-with-image, select#Shirts_Pocket_Styles.select-with-image, select#Shirts_Back_style.select-with-image, select#Shirts_Monogram_Options.select-with-image, selector: ".select-with-image", prevObject: n.fn.init[1], context: document]

So not sure why it would say undefined, maybe this is not a problem with the plugin.

websemantics commented 8 years ago

I wasn't able to re-create the issue, Can you please provide a working example, try using https://jsfiddle.net/

neillhanna commented 8 years ago

It is probably something to do with the way I am appending the elements to the DOM. My application is very complicated I do not know how to recreate the problem.

Anyway I have moved on to making my own solution using bootstrap dropdowns.

Thanks for your help.

On Wed, Sep 7, 2016 at 10:58 PM, Adnan M.Sagar, PhD < notifications@github.com> wrote:

I wasn't able to re-create the issue, Can you please provide a working example, try using https://jsfiddle.net/

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/websemantics/Image-Select/issues/31#issuecomment-245480334, or mute the thread https://github.com/notifications/unsubscribe-auth/AQhRDZNjVY_b1Crxo3fGuTQxU1UpRCSyks5qn3njgaJpZM4J2Fkc .

websemantics commented 8 years ago

You should not have to append the elements to the DOM dynamically. If you had to, this plugin doesn't support that and that's probably why your could get it to work!,

Good luck wit the bootstrap solution,