I'm trying to let a button
element switch its text between 'Follow' and 'Unfollow', but why isn't the javascript reacting on the first click on the button?
HTML:
<form method="post">
<button class="follow" onclick="this.innerHTML = follow_test(this.innerHTML)">
Follow
</button>
</form>
JavaScript:
function follow_test(string) {
if (string === 'Follow') { return ('Unfollow'); } else { return('Follow'); }
}
Aucun commentaire:
Enregistrer un commentaire