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 upadte the changed Values in alert #70

Closed dkedar closed 8 years ago

dkedar commented 8 years ago

Hello, I just gone through this demo you created on jsfiddle: http://jsfiddle.net/Km55L/1/ My question is if I deselect an Image then value of options also changed and in the alert can be display as well. How can I do that?

Regards Kedar

SgtOddball commented 8 years ago

If you look at the jQuery in the jsfiddle, it's got a listener that is looking for the multi select values to be changed and firing an alert box when that happens.

//Calls the select box with the class of image-picker and launches imagepicker function
jQuery("select.image-picker").imagepicker({
//Sets the select to display, normally you'd set this to true
  hide_select:  false,
    //this is triggered when an image is selected, passing over the selected option values
    selected: function(option){
        //Gets the values selected from the option that can be called using this.
        var values = this.val();
        //Triggers the alert box with the values selected. 
        alert(values);
    }
});

Easy.

rvera commented 8 years ago

Thank you @SgtOddball, that looks right/