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

215
Views
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 answers
Answer question

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 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!