Reputation: 569
I am using this to extract a checkbox
value:
var checkedValue = $('.messageCheckbox:checked').val();
However, when the checkbox is on, it displays "On", when is off, it displays nothing.
Like this:
Is checked (Yes): On
Is checked (No):
What should I change to make it appear on/off, and how can I change the language or at least edit the result's text?
Upvotes: 0
Views: 46
Reputation: 2181
Try this.
var text = checkedValue ? 'Yes' : 'No';
console.log(text);
https://jsfiddle.net/twugud15/
Upvotes: 1