how to fix issue on tampermonkey script

timo

i using a tampermonkey script but i have this error i dont know how to fix this issue .

the error displayed the source

document.onkeypress = async function(e) {
    e = e || window.event;
    var charCode = (typeof e.which == "number") ? e.which : e.keyCode;
    if (String.fromCharCode(charCode) === '=') {
        const {
            value: formValues
        } = await Swal.fire({
            title: 'Enter your credentials ',
            html: '<input id="swal-input1" class="swal2-input" placeholder="email"
            type = "text"
            value = "[email protected]" > ' +
            '<input id="swal-input2" class="swal2-input" placeholder="password"
            type = "password"
            value = "A23@" > ',
            focusConfirm: false,
            preConfirm: () => {
                return [
                    document.getElementById('swal-input1').value,
                    document.getElementById('swal-input2').value
                ][![enter image description here][1]][1]
            }
        })
Cüneyt Kılıç

Try to use ` ... ` ;
You can search about template string in javascript.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

document.onkeypress = async function(e) {
        e = e || window.event;
        var charCode = (typeof e.which == "number") ? e.which : e.keyCode;
        if (String.fromCharCode(charCode) === '=') {
            const {
                value: formValues
            } = await Swal.fire({
                title: 'Enter your credentials ',
                html: `<input id="swal-input1" class="swal2-input" placeholder="email" type = "text" value = "[email protected]" >
                       <input id="swal-input2" class="swal2-input" placeholder="password" type = "password" value = "A23@" > `,
                focusConfirm: false,
                preConfirm: () => {
                    return [
                        document.getElementById('swal-input1').value,
                        document.getElementById('swal-input2').value
                    ]
                }
            })

Also, you can try like below;

html: '<input id="swal-input1" class="swal2-input" placeholder="email" type="text" value="[email protected]"> <input id="swal-input2" class="swal2-input" placeholder="password" type="password" value="A23@" > ',

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related