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

267
Visualizações
I got the calendar icon to trigger jQuery datepicker, but it's linked to the wrong input

I have the start date input and a calendar icon, and right next to it is the end date input with its calendar icon. The start date calendar icon triggers the end date input datepicker, but I want the start date calendar icon to trigger the start date input datepicker. Below link is the picture of my result. The red checks trigger the end date input datepicker, and the blue check triggers the start date input datepicker.

my result

<td class="w40">
        <span class="date">
            <input type="text" class="input_date datepicker">
             <span class="icon btn_calendar"></span>
             ~
             <input type="text" class="input_date datepicker">
             <span class="icon btn_calendar"></span>
         </span>
      </td>



$(".datepicker").datepicker({
    changeMonth: true,
    changeYear: true
});

$.datepicker.setDefaults({
    dateFormat: 'yy년 mm월 dd일',
    prevText: '이전 달',
    nextText: '다음 달',
    monthNames: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
    monthNamesShort: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
    dayNames: ['일', '월', '화', '수', '목', '금', '토'],
    dayNamesShort: ['일', '월', '화', '수', '목', '금', '토'],
    dayNamesMin: ['일', '월', '화', '수', '목', '금', '토'],
    showMonthAfterYear: true,
    yearSuffix: '년'
});

$(".btn_calendar").click(function() {
  $(".datepicker").datepicker("show");
});
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I think you have to use id to identify exactly which button to trigger which input, and bind click event for each button.

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