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

212
Visualizações
pass id to a tag href in modal(bootstrap)

hy, i want to pass my id to a tag href in my modal(bootstrap), for know i using this to past my id from my modal button :

        modal.find('#down').attr('href', function(i, href) {
            return href + div.data('id');
        });

this is my a tag:

  <a type="button" id="down" href="<?php echo base_url(); ?>/aprove/download/">Berkas</a>

this is my modal button:

<a href="javascript:;" title="Lihat" data-id="<?php echo $q->id_project ?>"  data-toggle="modal" data-target="#lihat-data">                                                        <button data-toggle="modal" data-target="#ubah-data" class="btn btn-secondary"><i class="far fa-eye"></i></i></button>                                                  </a>

the problem its, every time i click the modal button, my a tag(href) will add previous id to the new one, like this:

first modal:

href="http://localhost/pe//aprove/download/4"

second modal:

href="http://localhost/pe//aprove/download/41"

i need to refresh the table to make it just get their own id

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

So do something like

<a type="button" id="down" data-href="<?php echo base_url(); ?>/aprove/download/">Berkas</a>

and read the data attribute

var anchor = modal.find('#down')
anchor.attr('href', anchor.data('href') + div.data('id'));
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