mercredi 17 juin 2015

if Html.CheckBox is checked or not

I have a simple question regarding html.checkbox

Using this as an example:

@Html.CheckBox("IncreaseStock", Model.IncreaseStock == null ? false : (bool)Model.IncreaseStock)

now doing a alert to see if the checkbox is tick or not:

 var IncreaseStock = $('#IncreaseStock').val();


if (IncreaseStock == true)
                {
                    alert("true ")
                }
                else
                {
                    alert("NOT TRUE")
                }

However when its false it still shows as true, even though i didnt click the check box.

Any ideas




Aucun commentaire:

Enregistrer un commentaire