I have a checklist that is dynamically armed with Jqurey
according to a previous selection, so
at times I can have 3 checks or 6 according to the profile of the user that I am going to edit.
I try to make the checks fill with the information as I select them,
otherwise they bring up to 50000 records and it takes a long time to load the screen.
I do not understand why the JQuery
selection does not work for me.
I want to get to span
with class dynatree-checkbox
that is within li
that
is within ul
with class dynatree-container
that is within div
with id jstree_autorizaciones
to assign the event click
and execute one
function "x".
Here I leave the rendered code so you can understand it better.
<div class="panel panel-default">
<div class="panel-body" style="height:260px;max-height:260px;overflow-y:auto;overflow-x:auto;">
<div id="jstree_autorizaciones">
<ul class="dynatree-container">
<li class="">
<span class="dynatree-node dynatree-folder dynatree-exp-c dynatree-ico-cf">
<span class="dynatree-connector"></span>
<span class="dynatree-checkbox"></span>
<span class="dynatree-icon"></span>
<a href="#" class="dynatree-title">Auditor</a>
</span>
</li>
<li class="">
<span class="dynatree-node dynatree-folder dynatree-exp-c dynatree-ico-cf">
<span class="dynatree-connector"></span>
<span class="dynatree-checkbox"></span>
<span class="dynatree-icon"></span>
<a href="#" class="dynatree-title">Control de Calidad</a>
</span>
</li>
<li class="">
<span class="dynatree-node dynatree-folder dynatree-exp-c dynatree-ico-cf">
<span class="dynatree-connector"></span>
<span class="dynatree-checkbox"></span>
<span class="dynatree-icon"></span>
<a href="#" class="dynatree-title">Control de Calidad en Bases</a></span>
</li>
<li class="">
<span class="dynatree-node dynatree-folder dynatree-exp-c dynatree-ico-cf">
<span class="dynatree-connector"></span>
<span class="dynatree-checkbox"></span>
<span class="dynatree-icon"></span>
<a href="#" class="dynatree-title">Inspector</a></span>
</li>
<li class="dynatree-lastsib">
<span class="dynatree-node dynatree-folder dynatree-lastsib dynatree-exp-cl dynatree-ico-cf">
<span class="dynatree-connector"></span>
<span class="dynatree-checkbox"></span>
<span class="dynatree-icon"></span>
<a href="#" class="dynatree-title">Tráfico</a>
</span>
</li>
</ul>
</div>
</div>
I can select the div
but then I can not make it select the rest.
With this I select the div
: $('#jstree_autorizaciones)
, then I try to add the
ul
doing $('#jstree_autorizaciones > ul.dynatree-container')
but here it does not work anymore and I do not know what I'm doing wrong, I still do not handle much JQuery but
from what I understand, it should work this way. Then I would continue with the selection until
get to span
containing the class dynatree-checkbox
, it would be something like this:
var check = $('#jstree_autorizaciones > ul.dynatree-container > li > span.dynatree-checkbox');