Uncaught TypeError: register.closeA is not a function at HTMLDivElement.onclick

1

I have a problem with a script to close a "Box" .. follow the codes below:

register_associated.php

<form name="cadastro" action="" method="post">
<input type="hidden" name="acao" value="cadastro_simples" />
<div class="matricula">
    <label>Matrícula</label>
    <input type="text" value="<?php echo $idd; ?>" readonly>
</div>
<div class="nome">
    <label>Nome Completo</label>
    <input type="text" name="nome" id="nome">
</div>
<div class="categoria">
    <label>Categoria</label>
    <select name="categoria" id="categoria">
        <option>Selecione a categoria</option>
        <option value="socio-efetivo">Sócio Efetivo</option>
        <option value="socio-contribuinte">Sócio Contribuinte</option>
    </select>
</div>
<div class="admissao">
    <label>Data de Admissão</label>
    <input type="date" name="admissao" id="admissao">
</div>
<div class="cadastrar" onClick="cadastro_simples();">CADASTRAR</div>
<div class="cancelar_cadastro" onclick="cadastro.fecharA();">CANCELAR</div>
</form>

script.js

var cadastro = {
associado: function(titulo, conteudo) {
    $('body').css({
        'margin': '0px',
        'padding': '0px'
    }).prepend('<div class="sombra_associado animated fadeIn"><div class="associado animated fadeInDown"><div class="topo"><div class="nome">SIGA<font style="font-size:10px;">V1.0</font></div><div class="titulo">' + titulo + '</div></div><div class="conteudo">' + conteudo + '</div></div></div>');
    $('.associado').fadeIn(200);
    $('.sombra_associado').fadeIn(200);
},
 fechar: function() {
    $('.associado').removeClass('animated fadeInDown').addClass('animated fadeOutUp');

    setTimeout(function() {
        $('.sombra_associado').removeClass('animated fadeIn').addClass('animated fadeOut');
        $('.sombra_associado').fadeOut(500);
        $('.associado').fadeOut(500);
        setTimeout(function() {
            $('.sombra_associado').remove();
        }, 500);

    }, 300);
}
}
What happens ... when I click on a button in my index it opens a box to register an associate, but when I click to cancel the registration, it instead of closing the box, it returns me the error "Uncaught TypeError: record.Close.It is not a function at HTMLDivElement.onclick ", the same code but with different variables, I used it for other similar functions in the site and they all worked, only this causes problems ..

    
asked by anonymous 22.02.2017 / 23:31

1 answer

1

The error is in the name only, seeing that in script.js the variable register is an object and has an attribute that is a function called "close".

var cadastro = {fechar: function() {}}

Proceed?

    
22.02.2017 / 23:47