jquery autocomplete How to set label and how to get value?
<p>I have a dynamic input field created with class name as sub-category.
On key press autocomplete is working fine, from which i can select one. </p>

<p>Working code for that is below</p>

<pre><code>$("body").on('keypress', 'input.sub-category', function () {
        var availableTags = [
            {label:"ActionScript", value:"1"},
            {label:"ActionScript1", value:"11"},
            {label:"ActionScript2", value:"12"},
            {label:"ActionScript3", value:"13"},
            {label:"ActionScript4", value:"14"},
        ];
        $(this).autocomplete({
            source: availableTags,
        });
    });
</code></pre>

<p>When i select one of the autosuggested text say 'ActionScript', it's value (1) should be available in the below code, how i can access it? On select alert function is working fine, so just need to know how to access value of the selected label.</p>

<pre><code>$("body").on('autocompleteselect', 'input.sub-category', function () {
        alert('here');
});
</code></pre>

<p>In addition to that i would like to know how to set the selected text in the input box rather than it's value.</p>