X-Editable JQuery Plugin - Select Get Source Object

Viewed 554

I am having issues trying to get the selected object rather than the "newValue" that is passed to the success callback.

Here is an example:

$("select").editable({
        type : "select",
        title: 'Select Fruit',
        source : [
            {text : "Apple", value: "option_1"},
            {text : "Orange", value: "option_2"},
            {text : "Mango",value: "option_3"},
            {text : "Strawberry",value: "option_4"}
        ],
        success:function(response,newValue){
            console.log(newValue); // newValue contains the "text" string ok..
            // How do I get the selected source object? eg. {text : "Orange", value: "option_2"}
            // So I can access the object like..
            console.log(newValue.value); // output option_*
        }
    });

Thanks Carl

1 Answers
Related