mardi 13 décembre 2016

How to display different HTML elements in if statement

Hello, I am new to HTML and JS therefore would like to ask for some help. Here I want to display two different HTML elements according if statement is true or false. However, it does not work. Could I get some help? (:

<!DOCTYPE html>
<html>
<body>


<script>
if (!user) {
    <h1> there is no user </h1>
} </script>


if (user) {
    <button type="button">Click Me!</button>
} </script>


</body>
</html>

Aucun commentaire:

Enregistrer un commentaire