Discussions » Creation Requests

Help me with simple code "if ..."

§
Posted: 18.08.2017.
Edited: 18.08.2017.

Help me with simple code "if ..."

<img id="captcha_image" src="/hcaptcha/api/image?hcaptcha_token=14.177.39.27&hcaptcha_opt=refresh&hcaptcha_csrf=5996d81dc18279.31734753&x=0.05173863468072448" onerror="location.reload(true);" alt="CAPTCHA Image">

var userip;
var csrf = '5996d81dc18279.31734753';

function reload(refresh) {
    var opts = '';
    if (refresh) {
        opts='&hcaptcha_opt=refresh';
    }
    $('#captcha_image').prop('src', '/hcaptcha/api/image?hcaptcha_token=' + $( "input[name='captcha_token']" ).val() + opts + '&hcaptcha_csrf=' + csrf + '&x=' + Math.random());
    return false;
}

function reloadOnError() {
    setTimeout(function (counter){
        reload(true);
    }, 500);
}       

how to "if (input)" img[src] transform every time, if "src" transform then run "code"

Post reply

Sign in to post a reply.