i using a tampermonkey script but i have this error i dont know how to fix this issue .
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]
}
})
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.
Comments