0
I need to get all the checkboxes CHECKED of a <div>
in which it has another <div>
daughter that this, possess a <input type="checkbox">
via
jQuery
.
Follows the structure:
<div class="metro perfil-filtro-expander-filtrados perfil-filtro-expander-overflow acoesFiltradas" id="acoesFiltradas">
<--! item 1 -->
<div style="padding-bottom: 10px;">
<input id="@item.SelectedValue" type="checkbox" />
<label for="@item.SelectedValue">
<b>@item.Title</b>
<br />
<span class="perfil-filtro-expander-descricao">
@item.Description
</span>
</label>
</div>
<--! item 2 -->
<div style="padding-bottom: 10px;">
<input id="@item.SelectedValue" type="checkbox" />
<label for="@item.SelectedValue">
<b>@item.Title</b>
<br />
<span class="perfil-filtro-expander-descricao">
@item.Description
</span>
</label>
</div>
<--! item 3 -->
<div style="padding-bottom: 10px;">
<input id="@item.SelectedValue" type="checkbox" />
<label for="@item.SelectedValue">
<b>@item.Title</b>
<br />
<span class="perfil-filtro-expander-descricao">
@item.Description
</span>
</label>
</div>
</div>
jQuery:
$("#copiarParaTodasAcoes").click(function () {
$(".acoesFiltradas :input:checked").each(function () {
alert('teste');
});
});
Knob:
<a href="">
<img class="perfil-expander-botoes" id="copiarParaTodasAcoes" src="~/Images/tecbox/icons/expander-copy-icon.png" />
</a>
The error is in the way you are calling in jQuery
$(".acoesFiltradas :input:checked")
change to$(".acoesFiltradas input:checked")
– Jeferson Assis
no feedback.. the alert is not displayed yet.
– Luiz Negrini
I did not pay attention to all the code, analyzing better, I checked that the error is on your button, the image is inside a link that this with the link to the same page
<a href="">
, it tries to call javascript, but the page is already redirects at the same time. https://jsfiddle.net/dbk7a1os/, I changed the javascript and html of the button.– Jeferson Assis
not working here, do not know why... Please enter the code based on my question as answer.
– Luiz Negrini