Skip to content

Commit

Permalink
Assignment-8 Not completly Done Yet
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Feb 25, 2018
1 parent cff57c9 commit 467b343
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html>

<head>
Expand Down Expand Up @@ -46,7 +46,7 @@ <h2>Choose a front-end technology</h2>
<div class="col-sm-6">
<p>What do you <strong>like</strong> about HTML?</p>
<div class="checkbox">
<label>
<label >
<input name="likesHTML" type="checkbox"> Learning the basics is trivial
</label>
</div>
Expand Down
32 changes: 30 additions & 2 deletions smartForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,33 @@ strength: {css: '', js: '', html: ''} ,
currentQuestion : '#welcome'
};

if(localStorage.getItem('userData'))
{
userData= JSON.parse(localStorage.getItem('userData'));

$('#welcome').hide();
$(userData.currentQuestion).show();
$('#name').val(userData.name);
$('#email').val(userData.email);
//console.log(localStorage.getItem('userData').name);
}

else
{
localStorage.setItem('userData', JSON.stringify(userData));
// console.log(localStorage);
}



$('#start').click(function()
{
// console.log("start");
$('#welcome').hide();
$('#q1').show();

userData.currentQuestion= "#q1";
localStorage.setItem('userData' , JSON.stringify(userData));
});

$('name').change(function(event)
Expand All @@ -28,11 +48,18 @@ $('#next').click(function()
{
if($('#name').val() && $('#email').val())
{
userData.name= $('name').val();
userData.email= $('email').val();
userData.name= $('#name').val();
userData.email= $('#email').val();
$('#welcome').hide();
$('#q1').hide();
$('#q2').show();


userData.currentQuestion="#q2";
localStorage.setItem('userData', JSON.stringify(userData));

//console.log($('#name').val());
//console.log($('#email').val());
}

else
Expand All @@ -46,6 +73,7 @@ $('#html').click(function()
//$('#welcome').show();
$('#q2').hide();
$('#q2a').show();

}
);

Expand Down

0 comments on commit 467b343

Please sign in to comment.