0
I have two spans that work as buttons, when clicking on them appears an input to put an email and if you click again hides these inputs.
I managed to do the following:
Click on span1 -> Input1 appears and disables span2, and if you click it again hides input1 but does not enable span2
And I would like to click on it again besides hiding the input1 it enables the span2, a kind of toggle()
in the off();
Follows the JS:
$('.new-step-email-aluno').hide();
$('#btn-aluno').on('click', function() {
$('.new-step-email-aluno').toggle();
$('#btn-familiar').off();
});
$('.new-step-email-familiar').hide();
$('#btn-familiar').on('click', function() {
$('.new-step-email-familiar').toggle();
$('#btn-aluno').off();
});
I don’t know if it’s clear, I’ll fix anything. vlw
I tried to adapt to my code and it didn’t work, remembering that I use spans and not pq Buttons I have more button on the same page and I have more inputs too. I tried to use an if to see if the input is with display None if it is not disabled and if you have it enabled, but it did not work out tb.
– user27585
just replace the snippets
var $buttons = $('button');
forvar $buttons = $('#btn-aluno,#btn-familiar');
andvar $input = $('input');
forvar $input = $('.new-step-email-familiar');
besidesvar aluno = $self.is('#aluno');
forvar aluno = $self.is('#btn-aluno');
andvar already = $('button.active').size() > 0;
forvar already = $('#btn-aluno.active,#btn-familiar.active').size() > 0;
– Felipe Assunção
Making these Replaces my code will work in your html.
– Felipe Assunção
Dude I managed to solve, it was simple, I don’t know if I can edit my post with the help link q solve the problem.
– user27585
I updated the code for you with the solution since Voce was having difficulty putting in your html
– Felipe Assunção