0
people developed this website and in the indenizometro part there is a fade.js where when the user clicks on one of the buttons it takes him to the next step
when doing this will appear a small form that he will have to enter this information and when clicking next he will take this information and insert it in the next step only that do not know how to do this is possible ?
the input information will be displayed in this step below
NOTE: it will not be stored in bank is only to display at the same time. need to do this via jQuery or JS
Follow my php and js code:
PHP:
<div class="box-informations">
<p class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor
incididunt ut labore et dolore magna aliqua</p>
<h4 class="subtitle">Selecione a causa: <i class="fa fa-question-circle"
aria-hidden="true"></i>
</h4>
<ul class="list-unstyled list-inline indenizometro-list">
<li class="list"><a class="link -morte">Morte</a></li>
<li class="list"><a class="link -invalidez">Invalidez</a></li>
</ul>
</div>
{{--Event morte--}}
<div class="box-informations-morte">
<h4 class="title">Causa: <span>Morte</span></h4>
<p class="subtitle">Insira os dados do paciente</p>
<div class="form-group row">
<div class="col-sm-6 col-xs-6">
<input type="text" name="mail" class="form-control" id="mail"
placeholder="DIGITE A IDADE"/>
</div>
<div class="col-sm-6 col-xs-6">
<input type="phone" name="phone" class="form-control" id="phone"
placeholder="SALARIO ATUAL"/>
</div>
</div>
<a class="btn-next-morte">Próximo</a>
</div>
<div class="box-protected-morte">
<img src="img/info-segurado.png" class="img-responsive img-segurado"/>
<p class="subtitle">Valor da indenização</p>
<h3 class="price"><span>R$</span>35.000,00</h3>
<a href="{!! route('indenizometro') !!}" class="btn-protected-morte">Proteja-se!<br/><span>Avançe para avaliar seu seguro</span></a>
</div>
{{--End event morte--}}
{{--Evend invalidez--}}
<div class="box-informations-invalidez">
<h4 class="title">Causa: <span>Invalidez</span></h4>
<p class="subtitle">Insira os dados do paciente</p>
<div class="form-group row">
<div class="col-sm-6 col-xs-6">
<input type="text" name="mail" class="form-control" id="mail"
placeholder="DIGITE A IDADE"/>
</div>
<div class="col-sm-6 col-xs-6">
<input type="phone" name="phone" class="form-control" id="phone"
placeholder="SALARIO ATUAL"/>
</div>
</div>
<a class="btn-next-invalidez">Próximo</a>
</div>
<div class="box-protected-invalidez">
<img src="img/info-segurado-2.png" class="img-responsive img-segurado"/>
<p class="subtitle">Valor da indenização</p>
<h3 class="price"><span>R$</span>25.000,00</h3>
<a href="{!! route('indenizometro') !!}" class="btn-protected-invalidez">Proteja-se!<br/>
<span>Avançe para avaliar seu seguro</span>
</a>
</div>
{{--End Event invalidez--}}
JS:
$(document).ready(function(){
$(".box-informations-morte").hide();
$(".box-protected-morte").hide();
$(".box-informations-invalidez").hide();
$(".box-protected-invalidez").hide();
//morte
$(".-morte").click(function(){
$(".box-informations").hide();
$(".box-informations-morte").fadeToggle('slow');
});
$(".btn-next-morte").click(function(){
$(".box-informations").hide();
$(".box-informations-morte").hide();
$(".box-protected-morte").fadeToggle('slow');
});
//end morte
//invalidez
$(".-invalidez").click(function(){
$(".box-informations").hide();
$(".box-informations-invalidez").fadeToggle('slow');
});
$(".btn-next-invalidez").click(function(){
$(".box-informations").hide();
$(".box-informations-invalidez").hide();
$(".box-protected-invalidez").fadeToggle('slow');
});
//end invalidez
thanks for the answer in case how are 2 inputs as would the code ? a yes and my button is a link with a class and not a <button> as would be that tbm on the call button on JS
– Felipe Henrique
@Kirito edited the code
– Rafael Augusto
@Kirito as more fields just follow the same logic,
– Rafael Augusto
daora only one more question in the case in the first step only has 2 buttons with death other of disability the choice has to be saved tbm in the place Could you show me how would tbm code please ? that are the links it should appear tbm in the last step <li class="list"><a class="link -death">Death</a></li> <li class="list"><a class="link -invalidity">Invalidity</a></li> a yes and the final outcome would have to have a title age example - 33 years for example in case I leave like this will only appear 33
– Felipe Henrique
@Kirito you want to click on it save too?
– Rafael Augusto
not friend just that because then will get a validation and will be saved in a database just want to leave dynamic to present to the client no need to save I want it to look like the result of the third image of my post I’m sorry for that is that I am very newcomer to this programming area
– Felipe Henrique
in your link you put <a class="link-invalidity" date-type="invalidity">Invalidity</a> sessionStorage.setItem('type', $(this). attr('data-type type'))
– Rafael Augusto
you put it inside the click of the button
– Rafael Augusto
Nice ai to make his chamadinah on apend would look like so $('. result-death'). append('<p>'+sessionStorage.idade +' | '+ sessionStorage.salario +' | '+ sessionStorage.morte +'</p>')
– Felipe Henrique
sessionStorage.setItem('death', $(this).attr('death')) my date-type I put the name of death there I only replace where this type screito by certain death ?
– Felipe Henrique
Okay, if the answer helped you, please dial as solved and give +1 :D
– Rafael Augusto
helped yes thanks friend even so that keeps giving Undefined haha
– Felipe Henrique
$('.btn-next-death'). on('click', Function(){ sessionStorage.setItem('age', $('input[name=age]').val(); sessionStorage.setItem('salary', $('input[name=salary]').val(); sessionStorage.setItem('death', $(this).attr('data-type')) $('result-death').append('<p>'+sessionStorage.idade +' | '+ sessionStorage.salario +' | '+ sessionStorage.morte +'</p>') });
– Felipe Henrique
my code did not work the date-type part did something wrong ?
– Felipe Henrique
@Kirito yes, you did wrong, I will update the code
– Rafael Augusto
@Kirito updated, you need to use exactly as I did above
– Rafael Augusto
I love you man you’re the best ahahha
– Felipe Henrique
Friend if I need to add a back button as it would look could help me?
– Felipe Henrique
@Kirito Explain better
– Rafael Augusto
In fact I already got only what kind when I click back and next again the data duplicates the one accessed on my site and right at home you will see the session indenizomrtro click on death and follow the steps when you get to the big gray button you will see a link to return By clicking on it and then clicking on next again you will see that it duplicates the data and then no longer want that when click-if in coltar that field clear this is the link of the site http://medicalseg.com.br/
– Felipe Henrique