Autocomplete on dynamically created textbox and update value on focus out of the textbox in JQuery
<p>My problem is related to creating an autocomplete functionality for a textbox that is dynamically created. And retrieve the modified value and pass it to the controller.</p>

<p>I need to get value from textbox irrespective of autocomplete click or hand written in dynamic created textbox.</p>

<p>I have a textbox thats created runtime like this</p>

<pre><code>    var txtBox= "&lt;input type='text' class='txtBox' style='min-width:10em;width:100%'  value=\"" + parent.text() + "\"&gt;";
    parent.html(txtBox);
$("input.txtBox").focus();

    $("input.txtBox").autocomplete({
                source: Data,
                select:function() {
    // Call a controller method.                        
                }
            });
</code></pre>

<p>Now, the problem im facing is that I need to pass the selected (mouse click/ hand written(new value)) to the controller's method.
If instead of selecting from the auto complete values, I write a new value, the value isn't retrieved in the method.</p>

<p>I also tried a blur function that would pick the value and send it to the controller's method. But this messes up everything because the onblur is called each time i click either of the autocomplete options and thereby taking an incomplete value and passing it to them controller method.</p>

<p>Anyone faced such issues? Or any better ways to accomplish this issue.</p>

<p>Appreciate any help.Thanks.</p>
