Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to add multiple text onclick in jquery non-modal dialog?
    primarykey
    data
    text
    <p>I need to log multiple messages in a jquery non-modal dialog and a textarea,</p> <p>I have an jqueryui autocomplete field from which i am selecting an option, on selecting the option it gets logged into the textarea.</p> <p>what I also want to do is get it to be logged in the non-modal dialog as well. How do i do that?. </p> <p>Here is the html.</p> <pre><code> &lt;div id="codes"&gt; &lt;label for="selectcodes"&gt;&lt;/label&gt; &lt;input id="selectcodes" size="25"&gt; &lt;textarea id="selectcodes-log"&gt;&lt;/textarea&gt; &lt;/div&gt; &lt;div id="dialog"&gt; &lt;div&gt; Here is the javascript, /*JSON data, JavaScript object */ var tag = [ "abc", "efg", "hij", "klm", "nop", "qrst"]; /* this function logs the selected autocomplete option into the textarea */ function selectcodes_log(message) { /*this is for logging the code into the textarea */ $("#selectcodes-log").val(function () { return this.value + "codes= " + message + ', '}).prependTo("#selectcodes-log"); /*this is what have tried to log into the non-modal dialog*/ $("#dialog").val(function(){return this.value + message +', '}).prependTo( "#dialog"); } /*selects multiple autocomplete values */ $("#selectcodes") .bind("keydown", function (event) { if (event.keyCode === $.ui.keyCode.TAB &amp;&amp; $(this).data("ui-autocomplete").menu.active) { event.preventDefault(); } }) `/* jquery ui autocomplete */` .autocomplete({ minLength: 0, source: function (request, response) { // delegate back to autocomplete, but extract the last term response($.ui.autocomplete.filter( tag, extractLast(request.term))); }, focus: function () { // prevent value inserted on focus return false; }, select: function (event, ui) { selectcodes_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(", "); $(this).val(""); return false; } }); /* function for a non modal dialog */ $(function () { $('#dialog').dialog({ autoOpen: true, open: function () { closedialog = 1; $(document).bind('click', overlayclickclose); }, focus: function () { closedialog = 0; }, close: function () { $(document).unbind('click'); }, buttons: { Ok: function () { $(this).dialog('close'); } } }); }); </code></pre> <p><a href="http://jsfiddle.net/pratik24/9VBNd/1/" rel="nofollow">http://jsfiddle.net/pratik24/9VBNd/1/</a></p>
    singulars
    1. This table or related slice is empty.
    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