summaryrefslogtreecommitdiffstats
path: root/lib/parse
diff options
context:
space:
mode:
authormarkcxz <markcxz@126.com>2014-09-10 10:27:27 +0800
committermarkcxz <markcxz@126.com>2014-09-10 10:27:27 +0800
commit4da4e28d0732399635e9c5d5f8787ae1f2163ba4 (patch)
treed393149cb3d99b1a7a955c45e8e95019a5380129 /lib/parse
parent9dc19026c6c849ee545204b5aecd84b22e7e8d84 (diff)
downloadgitbook-4da4e28d0732399635e9c5d5f8787ae1f2163ba4.zip
gitbook-4da4e28d0732399635e9c5d5f8787ae1f2163ba4.tar.gz
gitbook-4da4e28d0732399635e9c5d5f8787ae1f2163ba4.tar.bz2
fix radio input uncheck failed
Diffstat (limited to 'lib/parse')
-rw-r--r--lib/parse/renderer.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/parse/renderer.js b/lib/parse/renderer.js
index f467c23..e6854f2 100644
--- a/lib/parse/renderer.js
+++ b/lib/parse/renderer.js
@@ -118,8 +118,10 @@ GitBookRenderer.prototype._createCheckboxAndRadios = function(text) {
if (!match) {
return text;
}
- var quizIdentifier = 'quiz-row-' + this.id + '-' + this.quizRowId + '-' + this.quizIndex++;
- var field = "<input name='" + quizIdentifier + "' id='" + quizIdentifier + "' type='";
+ //fix radio input uncheck failed
+ var quizFieldName='quiz-row-' + this.id + '-' + this.quizRowId ;
+ var quizIdentifier = quizFieldName + '-' + this.quizIndex++;
+ var field = "<input name='" + quizFieldName + "' id='" + quizIdentifier + "' type='";
field += match[1] === '(' ? "radio" : "checkbox";
field += match[2] === 'x' ? "' checked/>" : "'/>";
var splittedText = text.split(fieldRegex);