Commit 0a501963 authored by Zac Wood's avatar Zac Wood
Browse files

Added search by CRN on homepage

parent 5de61c75
function search() {
const searchTable = document.getElementById('scheduleTable');
const crn = document.getElementById('search').value;
.then(section => section.json())
.then(section => addRow(searchTable, section));
function addRow(table, section) {
const tr = document.createElement('tr');
const fields = [, section.title, section.crn, section.professor, section.location, section.days];
fields.forEach(field => {
const td = document.createElement('td');
const txt = document.createTextNode(field);
<input type="text" title="search_text" placeholder="Enter CRN..."/>
<button title="search">Search</button>
<input type="text" id="search" title="search_text" placeholder="Enter CRN..."/>
<button title="search" onclick="search()">Search</button>
<!-- <h2>Search results</h2>
<table id="searchTable">
<th>Section Name</th>
<!-- <br><br> -->
<h2>Your classes</h2>
<table id="scheduleTable">
<th>Section Name</th>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment