Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
Add javascript enabler
Browse files Browse the repository at this point in the history
  • Loading branch information
pepe committed Nov 11, 2021
1 parent 171cc03 commit 1e41bde
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
18 changes: 15 additions & 3 deletions contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,28 @@ <h1>Here is the way to contact pepe.</h1>
<form>
<label>
message
<textarea name="message"></textarea>
<textarea placeholder="Text of message for pepe" name="message" onkeyup="enableBtn()"></textarea>
</label>
<label>
nick
<input name="nick" type="text"/>
<input placeholder="Your nick" name="nick" type="text" onkeyup="enableBtn()" />
</label>
<button>Post</button>
<button disabled="disabled" id="post-btn">Post</button>
</form>
</main>
</div>
<script>
function enableBtn() {
var nl = document.getElementsByName("nick")[0].value.length;
var ml = document.getElementsByName("message")[0].value.length;
var btn = document.getElementById("post-btn");
if ((nl > 0) && (ml > 0)) {
btn.disabled = false
} else {
btn.disabled = "disabled"
}
}
</script>
<script src="js/vendor/modernizr-3.11.8.min.js"></script>
<script src="js/app.js"></script>

Expand Down
4 changes: 4 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ footer {
aside {
display: flex;
flex-direction: column;
}

form {
margin: 1rem 3rem;
}

0 comments on commit 1e41bde

Please sign in to comment.