Answer the question
In order to leave comments, you need to log in
How to update captcha in Jquery?
I wrote such a code, it stably updates the captcha and everything works, but I can’t put an additional element or a button for updating, I don’t understand how to do it.
I added a link in which the icon is through i, but I don’t understand how to put the execution of the captcha function on it, it doesn’t exit through onClick.
$(document).ready(function captcha(captcha) {
document.querySelector('._captcha-img').addEventListener('click', function() {
var id = Math.random();
this.setAttribute('src', '/blog/wp-content/themes/twentyfifteen/captcha/img.php?id=' + id);
});
});
<div class="col-xs-5 text-left">
<img class="_captcha-img" src="<?php echo esc_url( get_template_directory_uri() ); ?>/captcha/img.php" height="45">
<a class="_captcha-img" id="reloadC"><i class="fa fa-refresh" aria-hidden="true"></i></a>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question