DropDownList field and Checkbox triggering a javascript function

0

I have two DropDownList and Checkbox fields that are responsible for entering value into an inputtext

How to make the javascript code know the status sent true or false from the CHECKBOX for the function.

DropDownList

<div class="col-md-10">
     @Html.DropDownList("PlanoId", null, htmlAttributes: new { @class = "form-control" })
</div>

Checkbox

<div class="checkbox">
      @Html.EditorFor(model => model.AnuncioDestaque)
</div>

How to do DropDownList Checkbox above, please enable Javascript below

$(document).ready(function () {
    $("#PlanoId, #AnuncioDestaque").on("change focusout", function () {

           //Pegar Status do Checkbox se vei true ou false
    });

});
    
asked by anonymous 29.10.2018 / 03:40

1 answer

2

No jQuery

document.getElementById('PlanoId').checked;

With jQuery

$('#PlanoId').is(':checked');
    
29.10.2018 / 05:02