Disable/hide button after click 5 times
Question
i am creating a custom wordpress theme and what i want is that when the user click for the 5th time on the downlaod button , the downlaod button should hide or disable after 5th click.
<script type="text/javascript">
function disableButton(btn){
document.getElementById(btn).disabled = true;
alert("Button has been disabled.");
}
<a class="dkpdf-button" id="btn" href="www.mysite.com" target="_blank"><span class="dkpdf-button-icon"><i class="fa fa-file-pdf-o"></i></span> <?php echo $pdfbutton_text;?></a>
this is the code i found on stackoverflow, not working for me, also i dont know how to make a count to 5 so that after clicking 5 times , button automaticaly disables
0
ajax, functions, javascript, php, plugins
2 years
2020-08-31T05:10:34-05:00
2020-08-31T05:10:34-05:00 0 Answers
67 views
0
Leave an answer