Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed to get updated value from a textarea
    primarykey
    data
    text
    <p>I have a textarea in which I am inserting values selected from the autocomplete field, What I want to do is get the updated value from the textarea.</p> <p>supposing I enter three characters a, b and c in the textarea I delete character c. The problem I have is-> again when I select a character from the autocomplete field the character selected does not show up in the textarea,</p> <p>The character does get added to the memory i.e. the html code. But does not show up in the textarea. Below is the html</p> <pre><code>&lt;div id="secondary" style="min-width:100px; min-height: 10px; float:left"&gt;write any character from a to f &lt;br/&gt; &lt;label for="somechar"&gt;&lt;/label&gt; &lt;input id="somechar" size="22"&gt; &lt;br&gt; &lt;textarea id="some-log" class="log" class="ui-widget-content"&gt;&lt;/textarea&gt; &lt;/div&gt; </code></pre> <p>Here is the Jquery and javascript code</p> <pre><code>var secondary = [ "a", "b", "c", "d", "e", "f"]; </code></pre> <p>the function below logs the message in the textarea. here is where i need the updated value. I dont know how i can use some thing like <code>var thought= $("textarea#some-log").val();</code> over here</p> <pre><code>function some_log(thought) { $("#some-log").append(thought+ ", ").prependTo("#some-log"); } $("#somechar") /* this function is required when selecting multiple values */ .bind("keydown", function (event) { if (event.keyCode === $.ui.keyCode.TAB &amp;&amp; $(this).data("ui-autocomplete").menu.active) { event.preventDefault(); } }) </code></pre> <p>This is Jquery autocomplete</p> <pre><code> .autocomplete({ minLength: 0, source: function (request, response) { // delegate back to autocomplete, but extract the last term response($.ui.autocomplete.filter( secondary, extractLast(request.term))); }, focus: function () { // prevent value inserted on focus return false; }, select: function (event, ui) { some_log(ui.item ? ui.item.value : "Nothing selected, input was " + this.value); var terms = split(this.value); // remove the current input terms.pop(); // add the selected item terms.push(ui.item.value); // add placeholder to get the comma-and-space at the end terms.push(""); this.value = terms.join(", "); return false; } }); </code></pre> <p><a href="http://jsfiddle.net/pratik24/MMpDv/" rel="nofollow">http://jsfiddle.net/pratik24/MMpDv/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload