IC: Multiple Answer, Single Input

In this example below you will see how to do a IC: Multiple Answer, Single Input with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by tswone, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright tswone ©

Technologies

  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>IC: Multiple Answer, Single Input</title>
  
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">

  <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'>

      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <div class="container">
  <div class="row">
    <ol class="breadcrumb breadcrumb-text breadcrumb-lg">
        <li><a href="#">Activity B</a></li>
        <li>Question 2</li>
      </ol>
  </div>
  <div class="row">
    <div class="col-sm-8">      
      <textarea placeholder="Question text here." data-qtext="121" name="q" id="" cols="30" rows="10">In the Gizmo, graph y = –x2 – 5x. State the intercepts and vertex.
        
x-intercepts: {in:1}     y-intercept: {in:2}     vertex: {in:3}</textarea>
    </div>
    <div class="col-sm-4">
      <a href="#" id="insert">Insert</a>
      <div class="area">
        <div class="cardy">
          <div class="caption">Short Answer Input</div>
          <div class="section form ">
            <div class="title">Answers</div>
            <ul class="answers">
              <li>
                <div class="input-group">
                  <span class="input-group-addon"><span class="icn glyphicon glyphicon-ok"></span></span>
                  <input type="text" class="form-control" value="1">
                  <div class="input-group-btn">
                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Exact &nbsp;<span class="label label-primary">123</span> <span class="caret"></span></button>
                    <ul class="dropdown-menu dropdown-menu-right">
                      <li class="dropdown-header">Number</li>
                      <li><a href="#">Exact Match</a></li>
                      <li><a href="#">...</a></li>
                      <li class="dropdown-header">String</li>
                      <li><a href="#">Exact Match</a></li>
                      <li><a href="#">Contains</a></li>
                    </ul>
                  </div>
                </div>
              </li>
              <li>
                <div class="input-group">
                  <span class="input-group-addon"><span class="icn glyphicon glyphicon-ok"></span></span>
                  <input type="text" class="form-control" value="2">
                  <div class="input-group-btn">
                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">...</button>
                  </div>
                </div>
              </li>
            </ul>
            <a href="#" data-action="addA"><span class="glyphicon glyphicon-plus-sign"></span></a>
          </div>    
      <!--     <div class="section">
              Filtered Input: <span class="results"></span>
            <div class="check"></div>
          </div>   -->
          <div class="section">
            <div class="input-layout">
                <input type="text" required="" id="in1" name="test" id="password">
                <span class="bar"></span>
                <label>Test Input Here</label>
            </div>
          </div>     
        </div>
      </div>
    </div>
  </div>
</div>
  <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js'></script>

  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/tswone/ic-multiple-answer-single-input-aNjNgp */
body,
button,
input,
select,
textarea {
  font-family: "Open Sans", open-sans, sans-serif;
}
ul,
li {
  list-style: none;
  margin: 0;
  padding: 0;
}
li {
  margin-bottom: 8px;
}
li .icn {
  color: #ccc;
}
li.ok .icn {
  color: green;
}
body {
  background-color: #E4E4E4;
}
.container {
  min-height: 900px;
  padding-top: 100px;
}
.breadcrumb-text {
  padding: 0;
  background: none;
}
.breadcrumb-lg {
  font-size: 130%;
}
[data-qtext] {
  box-sizing: border-box;
  padding: 15px;
  width: 100%;
  outline: none;
  background: none;
  border: none;
  font-size: 28px;
  border-radius: 4px;
}
[data-qtext]:hover {
  background-color: #eee;
}
[data-qtext]:focus {
  background-color: #eee;
}
.cardy {
  background-color: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  margin: 0 auto;
  padding-top: 18px;
}
.cardy .section {
  padding: 8px 18px;
  border-bottom: 1px solid #E6E6E6;
}
.cardy .section .title {
  color: #666;
  font-size: 15px;
  margin-bottom: 10px;
}
.cardy .section:last-child {
  border: none;
}
.cardy .caption {
  text-transform: uppercase;
  text-align: center;
  font-size: 11px;
  margin: -10px 0 0;
  color: #41B7BF;
}
.input-layout {
  position: relative;
  margin-top: 28px;
}
.input-layout label {
  color: #b8b5bd;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: .5px;
  position: absolute;
  pointer-events: none;
  left: 0;
  top: 2px;
  transition: .2s ease all;
}
.input-layout input[type=text] {
  display: inline-block;
  font-weight: 400;
  font-size: 26px;
  color: #1E2431;
  border: 0;
  width: 100%;
  height: 36px;
  line-height: 17px;
  padding: 1px 0 10px 2px;
  border-bottom: 1px solid #dadee6;
  box-shadow: none;
  transition: none;
  border-radius: 0;
  margin-bottom: 9px;
}
.input-layout input[type=text]:focus {
  outline: 0;
  padding-left: 0;
  text-transform: none;
  color: #1E2431;
}
.input-layout input[type=text]:focus ~ label,
.input-layout input[type=text]:valid ~ label {
  top: -24px;
  color: #A2AABD;
  opacity: 1;
  font-weight: 400;
  font-size: 11px;
  text-transform: uppercase;
}
.input-layout .bar {
  position: relative;
  display: block;
  width: 100%;
}
.input-layout .bar:after,
.input-layout .bar:before {
  content: '';
  height: 1px;
  width: 0;
  bottom: 9px;
  position: absolute;
  background: #41B7BF;
  transition: .2s ease all;
}
.input-layout .bar:before {
  left: 50%;
}
.input-layout .bar:after {
  right: 50%;
}
.input-layout input:focus ~ .bar:after,
.input-layout input:focus ~ .bar:before {
  width: 50%;
}


/*Downloaded from https://www.codeseek.co/tswone/ic-multiple-answer-single-input-aNjNgp */
(function() {
  var answers, answersEL, c, curTextArea, in1, refresh;

  curTextArea = '';

  jQuery.fn.extend({
    insertAtCaret: function(myValue) {
      return this.each(function(i) {
        var endPos, scrollTop, sel, startPos;
        if (document.selection) {
          //For browsers like Internet Explorer
          this.focus();
          sel = document.selection.createRange();
          sel.text = myValue;
          return this.focus();
        } else if (this.selectionStart || this.selectionStart === '0') {
          //For browsers like Firefox and Webkit based
          startPos = this.selectionStart;
          endPos = this.selectionEnd;
          scrollTop = this.scrollTop;
          this.value = this.value.substring(0, startPos) + myValue + this.value.substring(endPos, this.value.length);
          this.focus();
          this.selectionStart = startPos + myValue.length;
          this.selectionEnd = startPos + myValue.length;
          return this.scrollTop = scrollTop;
        } else {
          this.value += myValue;
          return this.focus();
        }
      });
    }
  });

  c = 3;

  console.log(curTextArea);

  $('[data-qtext]').on('focus', function() {
    curTextArea = $(this);
    return console.log(curTextArea);
  });

  $('#insert').on('click', function(e) {
    e.preventDefault();
    e.stopPropagation();
    return curTextArea.insertAtCaret('test');
  });

  answers = [];

  answersEL = $('.answers');

  refresh = function() {
    answers = [];
    return answersEL.find('input').each(function() {
      return answers.push($(this).val());
    });
  };

  // answers.push('(' + $(@).val() + ')')
  refresh();

  answersEL.on('keyup', 'input', function() {
    return refresh();
  });

  $('[data-action=addA]').on('click', function() {
    return answersEL.append($('<li><input type="text" value="" /></li>'));
  });

  // two numbers
  // \D*(\d)\D+(\d)\D*
  in1 = $('#in1');

  in1.on('keyup', function() {
    var a, ai, check, i, j, k, l, len, len1, len2, m, matches, mi, ok, p, re, v;
    p = '\\D*';
    for (i = j = 0, len = answers.length; j < len; i = ++j) {
      a = answers[i];
      if (i > 0) {
        p += '\\D+';
      }
      p += '(\\d+)';
    }
    p += '\\D*';
    re = new RegExp(p);
    // re = new RegExp('\\D*' + answers.join('\\D+') + '\\D*')
    console.log(re);
    v = $(this).val();
    matches = re.exec(v);
    check = 'wrong';
    ok = [];
    if (matches && matches[0] === v) {
      
      // console.log(matches[1] + ' and ' + matches[2])
      ok = [];
      console.log(answers);
      console.log(matches);
      for (ai = k = 0, len1 = answers.length; k < len1; ai = ++k) {
        a = answers[ai];
        for (mi = l = 0, len2 = matches.length; l < len2; mi = ++l) {
          m = matches[mi];
          if (!ok[ai] && mi > 0) {
            ok[ai] = m === a;
          }
        }
      }
      check = 'correct';
    }
    answersEL.find('>li').map(function(i) {
      var fnc;
      fnc = (ok[i] ? 'add' : 'remove') + 'Class';
      return $(this)[fnc]('ok');
    });
    $('.results').text(ok);
    return $('.check').text(check);
  });

}).call(this);

//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiPGFub255bW91cz4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFBQSxNQUFBLE9BQUEsRUFBQSxTQUFBLEVBQUEsQ0FBQSxFQUFBLFdBQUEsRUFBQSxHQUFBLEVBQUE7O0VBQUEsV0FBQSxHQUFjOztFQUVkLE1BQU0sQ0FBQyxFQUFFLENBQUMsTUFBVixDQUFpQjtJQUNqQixhQUFBLEVBQWUsUUFBQSxDQUFDLE9BQUQsQ0FBQTtBQUNiLGFBQU8sSUFBSSxDQUFDLElBQUwsQ0FBVSxRQUFBLENBQUMsQ0FBRCxDQUFBO0FBQ2YsWUFBQSxNQUFBLEVBQUEsU0FBQSxFQUFBLEdBQUEsRUFBQTtRQUFBLElBQUksUUFBUSxDQUFDLFNBQWI7O1VBRUUsSUFBQyxDQUFDLEtBQUYsQ0FBQTtVQUNBLEdBQUEsR0FBTSxRQUFRLENBQUMsU0FBUyxDQUFDLFdBQW5CLENBQUE7VUFDTixHQUFHLENBQUMsSUFBSixHQUFXO2lCQUNYLElBQUMsQ0FBQyxLQUFGLENBQUEsRUFMRjtTQUFBLE1BTUssSUFBSSxJQUFDLENBQUMsY0FBRixJQUFvQixJQUFDLENBQUMsY0FBRixLQUFvQixHQUE1Qzs7VUFFSCxRQUFBLEdBQVcsSUFBQyxDQUFDO1VBQ2IsTUFBQSxHQUFTLElBQUMsQ0FBQztVQUNYLFNBQUEsR0FBWSxJQUFDLENBQUM7VUFDZCxJQUFDLENBQUMsS0FBRixHQUFVLElBQUMsQ0FBQyxLQUFLLENBQUMsU0FBUixDQUFrQixDQUFsQixFQUFxQixRQUFyQixDQUFBLEdBQStCLE9BQS9CLEdBQXVDLElBQUMsQ0FBQyxLQUFLLENBQUMsU0FBUixDQ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