Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

556
Views
How do I put an asterisk for mandatory fields?

how do I put a red asterisk on a mandatory field ? For example title, location, Name, Email (for Owner section), Name,Email are required (*) and the Age and Location are optional

export default function App() {
  // ...
  return (
    <div className="flex flex-col">
     
      <form onSubmit={handleSubmit}>
        <span className="mr-3 h-6 text-md font-bold  leading-8 text-gray-500">
          Title:
        </span>
        <input
          type="text"
          value={title}
          placeholder="title"
          onChange={(e) => setTitle(e.target.value)}
        />
        <span className="mr-3 h-6 text-md font-bold  leading-8 text-gray-500">
          Location:
        </span>
        <input
          type="text"
          value={location}
          placeholder="Location"
          onChange={(e) => setLocation(e.target.value)}
        />
    //...
  );
}

Here what I'm saying in a picture : enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Give all of your label elements a class of required and add the following to your CSS:

.required::after {
    content: " *";
    color: red;
}

working example:

form {
    display: flex;
    flex-direction: column;
    width: 300px;
}

.required::after {
    content: " *";
    color: red;
}
<form>
    <label class="required" for="name">Name</label>
    <input id="name" class="field req" type="text" required>
</form>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!