rvera / image-picker

Image Picker is a simple jQuery plugin that transforms a select element into a more user friendly graphical interface.
http://rvera.github.com/image-picker
Other
907 stars 216 forks source link

Not working with dynamically added elements #125

Closed aalavandhaann closed 5 years ago

aalavandhaann commented 6 years ago

I really like your jquery component. But the problem is when I try adding the option tag dynamically to the select tag using jquery then there are not images loaded. What could be the problem here? I am iterating through a for loop creating the html tags dynamically and appending it to the select element. And then I call the $('select').imagepicker(). This approach is not showing the images at all. If I try to add the images inside the html hard-coded then it works as expected. Any ideas on how to resolve this?

Regards,

0K

rvera commented 6 years ago

Hi @aalavandhaann I assume this is a jQuery issue, probably the internal jQuery representation of the element and the html are out of sync. Did you try changing the select options using jquery first?

Humni commented 6 years ago

The pull request https://github.com/rvera/image-picker/pull/103 resolves this issue. It still needs some work though

rvera commented 6 years ago

@Humni let me know if you have time to look at this again. I've been swamped with work lately so I've slacked on this.

Humni commented 6 years ago

@rvera Likewise! I've put it on my todo list and will likely get to it sometime over the next 2 weeks

Humni commented 5 years ago

103 has been merged into 0.4.0-beta branch, and will be released once testing has been completed. Am closing this issue for now.