0
Good morning, stack overflow. I’m going through a strange problem, I don’t even know how to describe it.
Basically I have the 2 screens below
I am creating a form, where it will be necessary to register and edit in it. So my idea was to create 3 buttons, one to edit, or to register and another to cancel.
<div class="col-md-12">
<a href="javascript:;" id="EdicaoLocalidade" class="btn green EditarLocalidade">Editar Localidade</a>
<a href="javascript:;" id="CadastrarLocalidade" class="btn green CadastrarLocalidade">Cadastrar Localidade</a>
<a href="javascript:;" class="btn default Cancelar">Cancelar</a> </div>
The idea is, when you press the New Locale button, you can make the Edit button disappear, leaving only the Sign Up and Cancel button.
$('.page-toolbar a').click(function() {
inicNovaLocalidade();
$('.portlet.NovaLocalidade').slideDown();
$(this).addClass('disabled');
$(".EditarLocalidade").css("display","none");
});
The same idea would be to edit it, when you click on the pen, next to the data, ie to edit.
$(".Editar").on('click', function () {
$('.portlet.NovaLocalidade').slideDown();
$(".CadastrarLocalidade").css("display","none");
})
The bizarre problem, is when I press Edit first, the cancel button does not work at all, but if I press the New Locale, cancel it, works right, for both cases.
My idea is that when I hit the cancel, besides giving the slide down, I would undo the hidden effect of the button.
//evento click do cancelar
$('#CadastroLocalidade a.Cancelar').click(function() {
//teste para o botão cadastrar localidade
var editLocalidade = document.getElementById("EdicaoLocalidade");
var cadLocalidade = document.getElementById("CadastrarLocalidade");
if(editLocalidade.style.display != 'none'){
$('.portlet.NovaLocalidade').slideUp();
$('.page-toolbar a').removeClass('disabled');
$(".EditarLocalidade").css("display","inline-block");
}
});
UPDATING
When I click on this button here, that the cancel does not work... in any way, this error
What do you want to do is this? https://jsfiddle.net/mapquintal/fwx9qw1y/
– Marco Antonio Quintal
No, I need that when I click on that edit arrow, work cancel for example... and I don’t understand why it doesn’t work
– Gabriel falieri
is calling $(". Edit"). on('click', Function() { instead of $(". Editarlocality"). on('click', Function () {
– Marco Antonio Quintal
But that’s right, only cancel that doesn’t work, when I click on the Edit button
– Gabriel falieri
I can’t understand the mistake
– Gabriel falieri
I edited the question
– Gabriel falieri