+ 1
Can anyone can correct my code it is a login form
Can anyone can correct my code it is a login form but there is login and signup form both but only the sign in form is opening not the signup form can anyone help me to open both please reply https://code.sololearn.com/WdcBFP9y656Q/?ref=app
4 Answers
+ 3
With your current code without editing html you could do
window.onload = function() {
var buttons = document.getElementsByClassName("tab-group")[0].getElementsByTagName("a");
for(var a = 0; a < buttons.length; a++) {
buttons[a].addEventListener("click", function(event) {
clicked(event);
}, false)
}
}
function clicked(event) {
event.preventDefault();
document.getElementById("login").style.display = "none";
document.getElementById("signup").style.display = "none";
var element = event.target;
var id = element.getAttribute("href").substr(1, element.getAttribute("href").length);
document.getElementById(id).style.display = "block";
}
+ 5
You register form is hidden.
.tab-content > div:last-child {
display: none;
}
+ 2
but how can use both button