Hello
I'm developing a very simple script in javascript, where when I click the button for the first time, it calls the student () function and when clicking the same button strong> call teacher () , but not I am able to change content / strong>, where can I be wrong?
<html>
<head>
<title>Mudar Botão</title>
</head>
<body>
<input type="button" id="btnAlunos" value="Alunos" onclick="alunos()" />
<script type="text/javascript">
function aluno() {
alert("Eu sou um aluno");
}
function professor() {
alert("Agora eu sou professor");
}
document.getElementById("btnAlunos").onclick = function() {
var btnAlunos = document.getElementById("btnAlunos");
btnAlunos.value = "Professor";
btnAlunos.onclick = "professor()";
btnAlunos.id = "btnProfessor";
aluno();
};
document.getElementById("btnProfessor").onclick = function() {
professor();
};
</script>
</body>
</html>
Thank you in advance