Skip to content
Browse files

make answer case insensitive

  • Loading branch information...
1 parent 8045dd9 commit 62b6b622719f6714c1ec2e4ac90755f94a9767fb @yunfangjuan yunfangjuan committed Oct 9, 2012
Showing with 12 additions and 1 deletion.
  1. +3 −1 exercises/know_your_coworkers.html
  2. +9 −0 utils/answer-types.js
View
4 exercises/know_your_coworkers.html
@@ -63,7 +63,9 @@
<div class="question">
<p><var>IMG_STR</var></p>
</div>
- <div class="solution" data-type="text"><var>F_NAME[1]</var></div>
+ <div class="solution" data-type="text" data-case-insensitive>
+ <var>F_NAME[1]</var>
+ </div>
<div class="hints">
<p>Name: <var>F_NAME[1]</var>
</p>
View
9 utils/answer-types.js
@@ -74,8 +74,17 @@ Khan.answerTypes = $.extend(Khan.answerTypes, {
createValidator: function(solution) {
var correct = $.trim($(solution).text());
+ var caseSensitive =
+ $(solution).data("case-insensitive") === undefined ?
+ true : false;
+ if (!caseSensitive) {
+ correct = correct.toLowerCase();
+ }
return function(guess) {
guess = $.trim(guess);
+ if (!caseSensitive) {
+ guess = guess.toLowerCase();
+ }
return correct === guess;
};
}

0 comments on commit 62b6b62

Please sign in to comment.
Something went wrong with that request. Please try again.