Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

179
Visualizações
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 Respostas
Responde à pergunta

0

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

Finally this worked for me !!

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda