michaeladair
michaeladair

Reputation: 173

How to set input value using javascript program

Okay, so here is what I got here. I am using this site, [http://freedoge.co.in/#][1] with my auto-rolling bot. The bot I am using at the moment starts at the lowest value possible since there is already a button on the site for it. But, I want my bot to start at .05.

This is the input value that my bot needs to change before every roll...

<input id="double_your_doge_stake" type="text" style="text-align:center;" value="0.00000001" name="stake"></input>

And here is my bot script... it runs in the browser when the user uses inspect element and plays the program.

bconfig = {
    maxBet: 28000,
    wait: 200,
    toggleHilo: false
};
hilo = 'lo';
multiplier = 4;
rollDice = function () {
    if ($('#double_your_doge_bet_lose') .html() !== '') {
        $('#double_your_doge_2x') .click();
        multiplier++;
        if (bconfig.toggleHilo) toggleHiLo();
    } else {
        $('#double_your_doge_min') .click();
        multiplier = 2;
    }
    if (parseFloat($('#balance') .html()) < (parseFloat($('#double_your_doge_stake') .val()) * 2) ||
    parseFloat($('#double_your_doge_stake') .val()) > bconfig.maxBet) {
        $('#double_your_doge_min') .click();
    }
    $('#double_your_doge_bet_' + hilo + '_button') .click();
    setTimeout(rollDice, (multiplier * bconfig.wait) + Math.round(Math.random() * 100));
};
toggleHiLo = function () {
    if (hilo === 'lo') {
        hilo = 'lo';
    } else {
        hilo = 'lo';
    }
};
rollDice();

Upvotes: 1

Views: 732

Answers (1)

Mosho
Mosho

Reputation: 7078

Use val.

$('#double_your_doge_stake').val(value)

Upvotes: 2

Related Questions