Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get the Ids of checkbox I've checked?
    text
    copied!<p>I tried the below code,</p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;script type="text/javascript" src="http://static.jstree.com/v.1.0pre/jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://static.jstree.com/v.1.0pre/jquery.jstree.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="jstree_id" class="demo"&gt; &lt;ul&gt; &lt;li id="asia"&gt; &lt;a href="#" onClick="bridge('url','my_id')"&gt;asia&lt;/a&gt; &lt;ul&gt; &lt;li id="china"&gt; &lt;a href="#" onClick="bridge('url','my_id')"&gt;india&lt;/a&gt; &lt;/li&gt; &lt;li id="japan"&gt; &lt;a href="#" onClick="bridge('url','my_id')"&gt;japan&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li id="usa"&gt; &lt;a href="#" onClick="bridge('url','my_id')"&gt;usa&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;input type="text" id="com" onKeyUp="bridge('com_url','my_id')" /&gt; &lt;input type="text" id="person" onKeyUp="bridge('prsn_url','my_id')" /&gt; &lt;input type="button" value="click" onClick="bridge('url','my_id');" /&gt; &lt;script type="text/javascript" class="source"&gt; $(function () { $("#jstree_id").jstree({ "plugins" : [ "themes", "html_data", "checkbox", "sort", "ui" ] }); }); function bridge(path, tag) { // path &amp; tag are required one for Ajax functions* var checked_ids = []; $("#jstree_id").jstree("get_checked",null,true).each(function () { checked_ids.push(this.id); }); var company = $("#com").val() || []; var person = $("#person").val() || []; console.log(company+person+checked_ids); } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The question is: </p> <p>When I click on the <code>checkbox</code> it returns only the <code>ids</code> Iv'e already checked. How do I get the <code>ids</code> of currently checked <code>checkboxes</code>?</p> <p>My whole purpose of the code is to search the database against all combination of <code>checkbox tree</code> and <code>text</code> through <code>Ajax</code>.</p>
 

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