-2
Code is this:
<script>
$(document).ready(function () {
alert("funfo");
$("#segunda").click(function () {
var check = $("#segunda").is(":checked");
if (check == "true") {
alert("true");
} else {
alert("false");
}
alert(check);
});
});
</script>
Problem is, the guy selects the checkbox, returns false
, he clears, returns false
.. whereas true
returns when the box is selected, and false
when it is desiccated..
I used a alert(check);
and he returns true
, and false
, for marked and not marked, exactly as it was to do, but in checking the IF
it always returns an option, which in case is false
..
You are checking whether the var check is equal to "true"(string) instead of testing if it is
true
(note without the quotes)– Olimon F.
True. I thought that, a variable receiving a value, the value turned into string, but since there is no variable type declaration, I think that’s why it ends up "fitting" to what was!!
– Ale