Note that there are some explanatory texts on larger screens.

plurals
  1. POFinding list item from javascript generated html
    primarykey
    data
    text
    <p>Here is all the code I am using for this multiselect box which I found at <a href="http://quasipartikel.at/multiselect/" rel="nofollow">multiselect page</a></p> <p>HTML:</p> <pre><code>&lt;link href="jquery-ui.css" rel="stylesheet" /&gt; &lt;link href="ui.multiselect.css" rel="stylesheet" /&gt; &lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"&gt;&lt;/script&gt; &lt;script src="jquery.localisation-min.js"&gt;&lt;/script&gt; &lt;script src="ui.multiselect.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(function () { $(".multiselect").multiselect(); }); &lt;/script&gt; &lt;form runat="server"&gt; &lt;select class="multiselect" multiple="true" style="width:460px; height:200px;"&gt; &lt;option value="AA"&gt;AA@gmail.com&lt;/option&gt; &lt;option value="AB"&gt;AB@gmail.com&lt;/option&gt; &lt;option value="AC"&gt;AC@gmail.com&lt;/option&gt; &lt;option value="AD"&gt;AD@gmail.com&lt;/option&gt; &lt;option value="AE"&gt;AE@gmail.com&lt;/option&gt; &lt;option value="AF"&gt;AF@gmail.com&lt;/option&gt; &lt;/select&gt; &lt;asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click"/&gt; &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;/form&gt; </code></pre> <p>C#:</p> <pre><code>protected void Button1_Click(object sender, EventArgs e) { String[] emailList = new String[1000]; //find the ul in the html and loop through each li } </code></pre> <p>What this all translates into on the client side is this (I'm not sure all of this is 100% correct as I did just copy and paste if from the browser, however all of the relevant information is here): </p> <pre><code>&lt;div class="ui-multiselect ui-helper-clearfix ui-widget" style="width: 514px;"&gt; &lt;div class="selected" style="width: 272px;"&gt; &lt;div class="actions ui-widget-header ui-helper-clearfix"&gt; &lt;ul class="selected connected-list ui-sortable" id="multiselectedItems" runat="server" style="height: 164px;"&gt;ev &lt;li class="ui-helper-hidden-accessible" style=""/&gt; &lt;li class="ui-state-default ui-element ui-draggable" title="AA@gmail.com" style="display: list-item;"&gt;ev &lt;li class="ui-state-default ui-element ui-draggable" title="AB@gmail.com" style="display: list-item;"&gt;ev &lt;/ul&gt; &lt;/div&gt; &lt;div class="available" style="width: 234px;"&gt; &lt;/div&gt; </code></pre> <p>Now for the question, I need to find and loop through each of those list items in the unordered list, get the title attribute and store it in a string array when the button is clicked. I have already tried to find the control using Form.Request["multiselect"] and Page.FindControl["mutliselect"] but non of those worked. As always any help is welcome, thanks.</p> <p>EDIT #1: I looked and searched but there apparantly isn't a way to do this, however, instead of creating a new almost identical question, I'll just edit this one... Is there a way to modify the javascript file from the multiselect box I linked above? I thought if it is possible then it might be easier to just let the javascript add an attribute to the control within the select... I'm just not sure where in the javascript I can add this, so heres the updated question... Where in this multiselect javascript file must I edit in order to make it add an attribute to the correctly selected option?</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