Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. $(document).ready(function() {
  2.  
  3. alert("Document is ready!");
  4. $("#button").on("click", function() {
  5. // now we're going to work in here
  6. console.log("clicked");
  7. var comment = $("#comment-box").val();
  8. $("#visible-comment").html(comment);
  9. });
  10. $("#comment-box").on("keyup", function() {
  11. console.log("keyup happened"); //here we make sure we're catching keyup
  12. // in here is where the rest of our code for this lesson will go
  13. var charCount = $("#comment-box").val().length; //here we set the length of the content of the textarea to a variable
  14. console.log(charCount); //here we make sure we set it to the right value
  15. $("#char-count").html(charCount); //here we show a running character count to the user
  16. if (charCount > 50) {
  17. $("#char-count").css("color", "red"); // need to turn character count red
  18. } else {
  19. // need it to be black
  20. };
  21. });
  22. // all the rest of our code still goes up here
  23. return false;
  24. // no code here!
  25. $(".form-control").css("background-color", "pink");
  26. }); // here we close the doc ready. no more code below here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement