Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get checkbox value in multiselect onchange event
    primarykey
    data
    text
    <p>I implement jquery multiselect and its working properly now i need to add extra feature that when a user select another option in dropdown ( check another checkbox ) then i want to get the value of the related option </p> <p><img src="https://i.stack.imgur.com/c9Ik3.png" alt="enter image description here"></p> <p>in above picture in did not insert checkbox it is automatically inserted by jquery now i want that if i select the check =box with <code>XYZ</code> then i want to get the value of <code>XYZ</code> which is the <code>id</code> of <code>XYZ</code> </p> <p>here is how i implemented it </p> <pre><code> &lt;select multiple="multiple" id="CParent" name="parent" class="box2 required"&gt; @foreach (var item in Model.Categories.OrderBy(c =&gt; c.Name)) { if (Model.Coupon.Categoryid.Id == item.Id) { &lt;option selected="selected" value="@item.Id"&gt;@item.Name&lt;/option&gt; } else { &lt;option value="@item.Id"&gt;@item.Name&lt;/option&gt; } } &lt;/select&gt; </code></pre> <p>and it is how it looks like after rendering in browser source </p> <p><img src="https://i.stack.imgur.com/YauIW.png" alt="enter image description here"></p> <p>Thanks in advance for helping me .</p> <p>what i tried yet </p> <pre><code> $('#CParent input:checked').change(function () { var parentid = $(this).val()+''; var array = parentid.split(","); alert(array); getchildcat(array[array.length -1]); }); }); </code></pre> <p><strong>Edit</strong></p> <p>Code to initialize multiselect </p> <pre><code>$("#CParent").multiselect({ header: "Choose only THREE items!", click: function () { if ($(this).multiselect("widget").find("input:checked").length &gt; 3) { $(warning).show(); warning.addClass("error").removeClass("success").html("You can only check three checkboxes!"); return false; } else if ($(this).multiselect("widget").find("input:checked").length &lt;= 3) { if ($(warning).is(":visible")) { $(warning).hide(); } } } }); </code></pre>
    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