Skip to content

Commit

Permalink
add app iniciar code(sections, register behavior) b00tc4mp#129
Browse files Browse the repository at this point in the history
  • Loading branch information
Antuan94 committed Oct 23, 2024
1 parent 4d8e54d commit 0c8e02f
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions staff/antonio-guillen-illan/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ <h2>Home</h2>
</section>

<script>

var users = []
var sections = document.querySelectorAll('section')

var welcomeSection = sections[0]
Expand All @@ -87,16 +89,87 @@ <h2>Home</h2>
registerSection.style.display = ''



})

welcomeLoginLink.addEventListener('click', function (event) {
event.preventDefault()

welcomeSection.style.display = 'none'
loginSection.style.display = ''

})

var registerLinks = registerSection.querySelectorAll('a')

var registerLoginLinks = registerLinks[0]

registerLoginLinks.addEventListener('click', function (event) {
event.preventDefault()


registerSection.style.display = 'none'
loginSection.style.display = ''

})


var loginLinks = loginSection.querySelectorAll('a')

var loginRegisterLinks = loginLinks[0]

loginRegisterLinks.addEventListener('click', function (event) {
event.preventDefault()

loginSection.style.display = 'none'
registerSection.style.display = ''

})

var registerForm = registerSection.querySelector('form')

debugger
registerForm.addEventListener('submit', function (event) {
event.preventDefault()

var registerFormInputs = registerForm.querySelectorAll('input')

var registerFormNameImput = registerFormInputs[0]
var registerFormEmailImput = registerFormInputs[1]
var registerFormUsernameImput = registerFormInputs[2]
var registerFormPasswordImput = registerFormInputs[3]

var name = registerFormNameImput.value
var email = registerFormEmailImput.value
var surname = registerFormEmailImput.value
var password = registerFormPasswordImput.value

console.log(name, email, surname, password)

var user = {}
user.name = name
user.email = email
user.username = username
user.password = password

users.push(user)

registerForm.reset()

registerSection.style.display = 'none'
loginSection.style.display = ''

})











</script>
</body>
Expand Down

0 comments on commit 0c8e02f

Please sign in to comment.