How to call function inside HTML inside SWAL

Viewed 50
function stakeAmount() {
    swal({
        title: "{{trans('a_pdf.input_stake')}}",
        html: `<form action="{{ url('/stakeamount') }}" method="POST">`+
            `@csrf`+
            `<div class="row">`+
            `<input id="amount" name="amount" class="form-control" type="text" style="margin:10px;" autocomplete="off" required/>`+
            `<div class="input-group-append">`+
            ` <button class="btn btn-outline-secondary" id="max" style="color: #106EF3;" type="button" onclick="getMaxAmount()">MAX</button>`+
            `</div>`+
            ` </div>`+
            ` <button type="submit" class="btn btn-primary">{{trans('a_pdf.submit')}}</button>`+
            `</form>`,
        imageUrl: "../../../images/ethereum-eth.svg",
        showCancelButton: false,
        showConfirmButton: false,
        showCloseButton: true,
    });

}
        
function getMaxAmount(val) {
    $('#amount').val('');

    //console.log(from_currency);
    $.get("{{url("/getamount")}}", function (data) {
        console.log(data);
        $('#amount').val(data);

    });
}

Hi, I am trying to call this getMaxAmount() function inside html in swal. When I click on button MAX nothing happening. Fuction works in regular html, but inside swal it doesn't work. How to add some onlick inside swal function to works click on max button. Can someone help me? Thank you..

0 Answers
Related