Jquery how to get a hiddeninput given a data attribute -
i have checkboxes class mycheckbox , html5 attribute position.
for every checkbox of class checked want related hidden input class header has same html5 attribute value data-position. want make list of values of hiddenfields.
so checkbox this
<input type="checkbox" class="mycheckbox" data-position="@item.position"/>
and hidden input this:
<input type="hidden" data-position="@item.position" />
so came with:
$('input:checkbox.mycheckbox:checked').each(function () { var position = $(this).data('position'); $('input:hidden.header[data-position=need somehow position in here]').each(function () { }); });
so i'm unsure how specify position value checkbox in search hidden elements , how set values each hidden field list
you mean this:
$('input:hidden.header[data-position="' + position + '"]').each(function () {
Comments
Post a Comment