Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- alert("Document is ready!");
- $("#button").on("click", function() {
- // now we're going to work in here
- console.log("clicked");
- var comment = $("#comment-box").val();
- $("#visible-comment").html(comment);
- });
- $("#comment-box").on("keyup", function() {
- console.log("keyup happened"); //here we make sure we're catching keyup
- // in here is where the rest of our code for this lesson will go
- var charCount = $("#comment-box").val().length; //here we set the length of the content of the textarea to a variable
- console.log(charCount); //here we make sure we set it to the right value
- $("#char-count").html(charCount); //here we show a running character count to the user
- if (charCount > 50) {
- $("#char-count").css("color", "red"); // need to turn character count red
- } else {
- // need it to be black
- };
- });
- // all the rest of our code still goes up here
- return false;
- // no code here!
- $(".form-control").css("background-color", "pink");
- }); // here we close the doc ready. no more code below here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement