Job Board

HTML (index.html)

htmlCopy code<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="styles.css">
    <title>Job Board</title>
</head>
<body>
    <div class="container">
        <h1>Job Board</h1>
        <form id="jobForm">
            <input type="text" id="jobTitle" placeholder="Job Title" required>
            <input type="text" id="company" placeholder="Company" required>
            <textarea id="description" placeholder="Job Description" required></textarea>
            <button type="submit">Add Job</button>
        </form>
        <div id="jobList" class="job-list"></div>
    </div>

    <script src="script.js"></script>
</body>
</html>

CSS (styles.css)

cssCopy codebody {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h1 {
    text-align: center;
}

form {
    display: flex;
    flex-direction: column;
}

input, textarea {
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

button {
    padding: 10px;
    background: #5cb85c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    background: #4cae4c;
}

.job {
    padding: 15px;
    border: 1px solid #ddd;
    margin-top: 10px;
    border-radius: 4px;
    background: #fafafa;
}

.job h3 {
    margin: 0;
}

.job p {
    margin: 5px 0;
}

JavaScript (script.js)

javascriptCopy codedocument.getElementById('jobForm').addEventListener('submit', function(event) {
    event.preventDefault();

    const jobTitle = document.getElementById('jobTitle').value;
    const company = document.getElementById('company').value;
    const description = document.getElementById('description').value;

    addJob(jobTitle, company, description);

    // Clear form fields
    this.reset();
});

function addJob(title, company, description) {
    const jobList = document.getElementById('jobList');

    const jobDiv = document.createElement('div');
    jobDiv.className = 'job';

    jobDiv.innerHTML = `
        <h3>${title}</h3>
        <p><strong>Company:</strong> ${company}</p>
        <p>${description}</p>
    `;

    jobList.appendChild(jobDiv);
}

How to Run the Project

  1. Create the Files: Create three files named index.html, styles.css, and script.js in a folder.
  2. Copy the Code: Copy the respective code into each file.
  3. Open in Browser: Open index.html in a web browser to view your job board.

Features You Can Add

  • Data Persistence: Use local storage or a backend service (like Firebase or a simple Node.js server) to save job postings.
  • Search Functionality: Implement a search bar to filter job postings.
  • Categories or Tags: Add the ability to categorize jobs.
  • Responsive Design: Enhance the CSS for better responsiveness on mobile devices.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *