168
rated 0 times
[
173]
[
5]
/ answers: 1 / hits: 82590
/ 11 Years ago, mon, november 11, 2013, 12:00:00
Is there a better way to improve the below statement to check if the val()
is 'true'
or 'false'
and if it is then it will change it to a Boolean. The reason being, some of the values may be a word.
var thisval = $(this).val();
if (thisval == true){
ao[id] = true;
} else if (thisval == false){
ao[id] = false;
} else {
ao[id] = $(this).val();
}
More From » javascript