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

242
Views
How to disable button permanently after click ,buttons created from server data using loops?

I have a list of buttons on a page that is created using a database, I would like to disable the user click button permanently. Button should be in diable mode after page load too.

<div class="panel-group" id="posts">  
            <?php  
            while($row = $query->fetch(PDO::FETCH_ASSOC))
            {  
            ?>  
              <button id='registedButton' type='button' onclick='getButtonDataId(this)' data-id=<?php echo $row["Acronym"]; ?>>Applied</button> 
             }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

<div class="panel-group" id="posts">  
        <?php  
        while($row = $query->fetch(PDO::FETCH_ASSOC))
        {  
        ?>  
          <button id='registedButton_<?php echo $row["Acronym"]; ?>' type='button' class="registedButton" data-id=<?php echo $row["Acronym"]; ?>>Applied</button> 
         <?php } ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

<script>
$(document).ready(function(){
   $(".registedButton").each(function() {
        var getCookieName = $(this).attr('id');
        if(getCookie(getCookieName)){
           $(this).prop('disabled',true);
        }
   });
});
$('.registedButton').on('click', function(e) {
 var cookieName = $(this).attr('id');
 var eCookie = setCookie(cookieName, 'setVal');
 e.preventDefault();
 $(this).prop('disabled',true);
});
</script>
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!