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

139
Views
How to I use get document.getElementById for changing button div

My code is

<div class="flex-shrink-1 " id="request_btn<?= $contact['id'] ?>">
  <button data-request-to="<?= $contact['id'] ?>" data-request-from="<?= $_SESSION['id'] ?>" class="btn btn-sm btn-primary send_request" >Send Request
  </button>
</div>
<div class="flex-shrink-1 " id="del_request<?= $contact['id'] ?>">
  <button data-request-to="<?= $contact['id'] ?>" data-request-from="<?= $_SESSION['id'] ?>" class="btn btn-sm btn-danger del_request"  style="display:none;">Reject Request
  </button>
</div>

I want to use in JavaScript

document.getElementById("del_request[int_values]").setAttribute('style','display:none');

document.getElementById("del_request[int_values]").removeAttribute('style'); 

and

document.getElementById("send_request[int_values]").setAttribute('style','display:none');

document.getElementById("send_request[int_values]").removeAttribute('style'); 

I hope you will understand, How can I add send_request[int_values] in javascript

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

0

you can do something like

var a = [int_values] // for multiple values, can be taken as input of a function

var elementId = "send_request" + a ;

document.getElementById(elementId)
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!