-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
24 lines (22 loc) · 790 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const jobBtn = document.getElementById("search-btn");
const jobListings = document.getElementById("searchinput");
jobBtn.addEventListener("click", () => {
// Perform API call to retrieve job listings
fetch("https://example.com/api/jobs")
.then(response => response.json())
.then(data => {
// Clear previous job listings
jobListings.innerHTML = "";
// Create list items for each job
data.jobs.forEach(job => {
const li = document.createElement("li");
li.innerHTML = `<h3>${job.title}</h3>
<p>${job.company} - ${job.location}</p>
<p>${job.description}</p>`;
searchinput.appendChild(li);
});
})
.catch(error => {
console.error(error);
});
});