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

How to clear all selections? #91

Closed antonang closed 7 years ago

antonang commented 7 years ago

I will like to set up a checkbox , which when checked, would clear all the image selections (reset their values as well as clearing the blue borders around each selected image).

How do I achieve this? What is the function to call?

Thank you very much.

michelre commented 7 years ago

It looks like the selected items have a selected class. So you can use something like $('.selected').each(function(){ this.click() }).

rvera commented 7 years ago

Easiest way would be to update the select element then sync the picker with the select $("select").data('picker').sync_picker_with_select();