I'm unsing this version of combobox... combobox
...and I'm trying to get the menu items and then create a json array, here's the code I came up wtih so far...
"keyup .ui-combobox-input":function(event){
if(event.keyCode==13){
event.preventDefault();
newItem=$(this.uiInput).val()
this.element.append('<option value="'+newItem+'">'+newItem+'</option>');
var text=JSON.stringify(this.element.text());
};
}
The out put I get from var text is this...
"\n\t\t\t\t\t\t\t\t\t\t\tone moretwothreefour"
but I want this...
[{"value":"1", "label":"one more"}, {"value":"2", "label":"two"}, {"value":"3", "label":"three"}, {"value":"4", "label":"four"}]
I don't get what the escaped n and t's are and when I try to convert text to an array using this text=$.parseJSON(text); text is not converted to an array.