I have a kanban where the user can change the state or set it as priority I am able to get the id of the step however I am unable to get the checkbox value my checkbox value is always true.
Here is my html (this html repeats several times if there are for exemple 10 task then this code would repeat 10 times.)
<form method="post">
<p style="padding:0px;margin:0px">
<b>Etapa:</b>
@Html.DropDownListFor(x => lv_task.contrato_etapa_id, new SelectList(lv_task.etapas, "etapa_id", "nombre_etapa"), htmlAttributes: new { @id="drEtapa", @class = "form-control-kanban-popup-dropdown", @required = "required" })
</p>
<p style="padding:0px;margin:0px">
<label class="checkbox-text">
Prioridad
@Html.CheckBoxFor(x=>lv_task.contract_details.prioritario)
<span class="checkmark"></span>
</label>
</p>
<button id="@lv_task.contract_number">Actualizar y cerrar ventanilla</button>
</form>
Here is my jquery so far
$(document).ready(function () {
$("button").click(function (e) {
e.preventDefault();
$.ajax({
type: "POST",
url: "/kanban/salvarEstado",
data: {
id_etapa: $('#drEtapa').val(),
prioridad: $('#chkPrioridad').val()
},
success: function (result) {
alert('ok');
},
error: function (result) {
alert('error');
}
});
});
});
My problem is that the following code is always true
$('#chkPrioridad').val()
I am using the custom checkbox from w3school that can be found here https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_custom_checkbox
the code that changes when checkbox is checked is the following
<span class="checkmark"></span> //NOT CHECKED
<span class="checkmark"> //IS CHECKED
::after
</span>
Any help would be very appreciated thank you.