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

SELECTED HTML attribute is making it appear like selected but ignored when sending form #141

Closed AntoineWtrnd closed 4 years ago

AntoineWtrnd commented 5 years ago

All in the title.

<option data-img-src='..."' data-img-class='minImg' value='.....' selected>...</option>

Will make the image selected (border active), but when form is sended, imagePicker seem to ignore you have to execute the onClick action to make it selected... strange thing.

I tried using my PHP script with a normal select, it work. So, look like your plugins declare it as SELECTED only if there an onClick action on it.

Don't understand the point of that...

Edit: saw this on the docs " Note: Select items are hidden by default when using Image Picker. They are left visible in the examples for pedagogical purposes. "

I just really really really don't understand the point of hiding a selected image, and make it appear a wrong selected image. Oh my god.

Humni commented 5 years ago

I'm not quite following what you are meaning. Are you wanting the select box to be visible? The docs are meaning that the original select element will be hidden and only the images will be visible, it has nothing to do with which one is "selected" or not

Additionally, when you select an image, the hidden select element's value is updated to the selected option.

Humni commented 4 years ago

Closing as the OP did not provide more information. Please provide a JS fiddle with more information