Widget:FaqViewer: Difference between revisions

Jump to navigation Jump to search
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 721: Line 721:
} else if(sub.indexOf(',' != -1)){
} else if(sub.indexOf(',' != -1)){
var subSplit = sub.split(',');
var subSplit = sub.split(',');
console.log(subSplit);
$.each(subSplit, function(subI, subVal){
$.each(subSplit, function(subI, subVal){
pushToClean(main, $.trim(subVal), ques, ans);
pushToClean(main, $.trim(subVal), ques, ans);
Line 743: Line 742:
}
}
if(cleanJSON[main][sub].length){
if(cleanJSON[main][sub].length){
cleanJSON[main][sub].sort();
cleanJSON[main][sub].push({"question": ques, "answer":ans});
cleanJSON[main][sub].push({"question": ques, "answer":ans});
questionList.push(ques);
questionList.push(ques);
Line 755: Line 755:
$.each(cleanJSON, function(mainKey, mainValue){
$.each(cleanJSON, function(mainKey, mainValue){
html += "<h3>"+mainKey+"</h3><div class='accordion'>";
html += "<h3>"+mainKey+"</h3><div class='accordion'>";
mainValue.sort();
$.each(mainValue, function(subKey, subValue){
$.each(mainValue, function(subKey, subValue){
html += "<h3>"+subKey+"</h3><div class='accordion'>";
html += "<h3>"+subKey+"</h3><div class='accordion'>";

Latest revision as of 15:04, 1 February 2019