Accent problem in text returned by Javascript file

Asked

Viewed 40 times

-1

Good evening, everyone Initiating javascript studies I made a js code that constitutes a guest control system for a party. The guest states his name and the name of the guest who invited him in an html/css form If your name is on the guest list of the owner and he has entered the name of the party owner correctly javascript returns in the html form "You can enter" and otherwise "You cannot enter" The problem is that these two messages are within the JS and are coming with the unnatural accentuation. In HTML I put the tag and for every html form solved just not for those two sentence that comes from JS. I put ut8 up on the link to JS and did not solve. I will post the code below:

function VerificarEntrada() {
    NomeConvidado = document.getElementById('nome').value;
    convidadoPor = document.getElementById('convidadoPor').value;
    dono = 'Cristian';
    ConvidadosCristian = ['Amanda', 'Sabrina', 'Rafael', 'Jonas', 'Carol', 'Jhonatan'];
    if (ConvidadosCristian.includes(NomeConvidado) && convidadoPor === dono){
        document.getElementById('PermissaoDeEntrada').innerText = 'Você pode entrar';
    } else {
        document.getElementById('PermissaoDeEntrada').innerText = 'Você não pode entrar'
    }
}
<!DOCTYPE html>
<html lang="pt-BR">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Sistema de convites Festa</title>
    <link rel="stylesheet" href="./css/style.css">
    <script src="./js/sistemaConvitesFesta.js" charset="utf-8"></script>
</head>
<body>
    <div class="container">
        <div id="contact">
            <h3>Verifique se você foi convidado e pode entrar</h3>
            <fieldset>
                <input id="nome" tabindex="1" type="text" placeholder="Digite o seu nome:" required autofocus>
            </fieldset>
            <fieldset>
                <input id="convidadoPor" tabindex="2" type="text" placeholder="Quem convidou você?" required>
            </fieldset>    
            
            <fieldset>
                <button onclick="VerificarEntrada()" name="submit" type="submit" id="contact-submit">Verificar</button>
            </fieldset>
            
            <h4>Você está permitido entrar?</h4>
            <label for="" id='PermissaoDeEntrada' >Pesquisando...</label>
        </div>
    </div>        
</body>
</html>

1 answer

-1

Good afternoon, Rafael.

I tested your code and does not appear to have any problem.

Acentuação funcional.

Which browser are you using? Have you tried clearing the cache? Refresh & Clear Cache -> Cntrl+F5

If the problem persists, try using the following javascript:

function VerificarEntrada() {
    NomeConvidado = document.getElementById('nome').value;
    convidadoPor = document.getElementById('convidadoPor').value;
    dono = 'Cristian';
    ConvidadosCristian = ['Amanda', 'Sabrina', 'Rafael', 'Jonas', 'Carol', 'Jhonatan'];
    if (ConvidadosCristian.includes(NomeConvidado) && convidadoPor === dono){
        document.getElementById('PermissaoDeEntrada').innerHTML = 'Você pode entrar';
    } else {
        document.getElementById('PermissaoDeEntrada').innerHTML = 'Você não pode entrar'
    }
}
<!DOCTYPE html>
<html lang="pt-BR">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Sistema de convites Festa</title>
    <link rel="stylesheet" href="./css/style.css">
    <script src="./js/sistemaConvitesFesta.js" charset="utf-8"></script>
</head>
<body>
    <div class="container">
        <div id="contact">
            <h3>Verifique se você foi convidado e pode entrar</h3>
            <fieldset>
                <input id="nome" tabindex="1" type="text" placeholder="Digite o seu nome:" required autofocus>
            </fieldset>
            <fieldset>
                <input id="convidadoPor" tabindex="2" type="text" placeholder="Quem convidou você?" required>
            </fieldset>    
            
            <fieldset>
                <button onclick="VerificarEntrada()" name="submit" type="submit" id="contact-submit">Verificar</button>
            </fieldset>
            
            <h4>Você está permitido entrar?</h4>
            <label for="" id='PermissaoDeEntrada' >Pesquisando...</label>
        </div>
    </div>        
</body>
</html>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.