Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">
  <h2>Instructor's Information</h2>
  <form id="instructorForm">
    <input type="text" id="instructorName" placeholder="Instructor's Name" required>
    <input type="email" id="instructorEmail" placeholder="Instructor's Email" required>
    <input type="text" id="className" placeholder="Class Name" required>
    <button type="submit">Generate QR Code</button>
  </form>
  <div id="qrcode"></div>
</div>
<div class="container">
  <h2>Student Check-In</h2>
  <form id="studentForm">
    <input type="text" id="studentName" placeholder="Your Name" required>
    <input type="text" id="studentID" placeholder="Student ID" required>
    <button type="submit">Check-In</button>
  </form>
</div>
<div class="container">
  <h2>Checked-In Students</h2>
  <ul id="checkedInList"></ul>
</div>

              
            
!

CSS

              
                /* Global styles */
body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background-color: #f2f2f2;
}

.container {
  max-width: 350px; /* Adjust as needed */
  margin: 20px auto;
  background-color: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

input[type="text"],
input[type="email"],
button {
  width: calc(100% - 20px); /* Adjust for button padding */
  margin-bottom: 10px;
  padding: 10px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 5px;
}

button {
  background-color: #007bff;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: #0056b3;
}

ul {
  list-style: none;
  padding: 0;
}

li {
  margin-bottom: 5px;
}

/* Media query for smaller screens */
@media (max-width: 400px) {
  .container {
    max-width: 300px;
    padding: 15px;
  }
}

              
            
!

JS

              
                // Function to generate QR code based on instructor's information
function generateQRCode() {
  var instructorName = document.getElementById("instructorName").value;
  var instructorEmail = document.getElementById("instructorEmail").value;
  var className = document.getElementById("className").value;
  var qrData = {
    instructorName: instructorName,
    instructorEmail: instructorEmail,
    className: className
  };
  var qrCodeText = JSON.stringify(qrData);
  var qrCodeDiv = document.getElementById("qrcode");
  qrCodeDiv.innerHTML = ""; // Clear previous QR code if any
  new QRCode(qrCodeDiv, qrCodeText);
  
  // Here you would store qrCodeText in your database
  // This step depends on your backend implementation
}

// Function to handle instructor form submission
document.getElementById("instructorForm").addEventListener("submit", function(event) {
  event.preventDefault(); // Prevent default form submission
  generateQRCode(); // Call function to generate QR code
});

// Function to handle student check-in form submission
document.getElementById("studentForm").addEventListener("submit", function(event) {
  event.preventDefault(); // Prevent default form submission
  var studentName = document.getElementById("studentName").value;
  var studentID = document.getElementById("studentID").value;
  
  // Here you would store studentName and studentID in your database
  // This step depends on your backend implementation
  
  // For now, let's just add the student's information to the displayed list
  var checkedInList = document.getElementById("checkedInList");
  var listItem = document.createElement("li");
  listItem.textContent = studentName + " - " + studentID;
  checkedInList.appendChild(listItem);
  
  // Reset the form fields after submission
  document.getElementById("studentName").value = "";
  document.getElementById("studentID").value = "";
});

              
            
!
999px

Console