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

178
Views
How to fetch the dropdown value in edit form using jquery?

I have a form with dropdown in it and when I am adding the data it is going to database. When I click on edit I can fetch the values of all other fields but the drop down is not showing the value which was added previously in the dropdown can some one please help ??

I am trying to do this with jquery ,

I am using semantic for frontend with jsp and servlet for the backend and database in postgres

this is what i have tried found this on semantic behavior but its only setting the value as default

$("#iddropdown").dropdown('set selected', ['fruits']);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.js" integrity="sha512-dqw6X88iGgZlTsONxZK9ePmJEFrmHwpuMrsUChjAw1mRUhUITE5QU9pkcSox+ynfLhL15Sv2al5A0LVyDCmtUw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css" integrity="sha512-8bHTC73gkZ7rZ7vpqUQThUDhqcNFyYi2xgDgPDHc+GXVGHXq+xPjynxIopALmOPqzo9JZj0k6OqqewdGO3EsrQ==" crossorigin="anonymous" referrerpolicy="no-referrer"
/>
<div class="eight wide field">
  <label> Product Category </label>
  <select id="iddropdown" class="ui dropdown" name="category">
    <option value="category"> Category </option>
    <option value="fruits"> Fruits </option>
    <option value="vegetables"> Vegetables </option>
    <option value="rice"> Rice </option>
    <option value="flour"> Flour </option>
    <option value="snacks"> Snacks </option>
    <option value="beverages"> Beverages </option>
    <option value="sauces"> Sauces </option>
    <option value="cereal"> Cereal </option>
    <option value="spices"> Spices </option>
    <option value="pulses"> Pulses </option>
    <option value="cheese"> Cheese </option>
  </select>
</div>

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

0

$("#iddropdown").dropdown('set selected', ['${product.category}'] );

Finally this worked for me !!

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!