Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
<textarea id="tweet_entered"></textarea>
  <p id="tweet_length"></p>
</body>
</html>
 
window.onload = function(){
    var tweet = document.getElementById("tweet_entered");
    tweet.onkeypress = checkTweetLength;
}
    function checkTweetLength() {
    if(this.value.length > 140) {
        console.log('Hey');
        document.getElementById("tweet_length").innerHTML =   140 - this.value.length; 
    }else {
        console.log('else block');
        document.getElementById("tweet_length").innerHTML = this.value.length;
    }
 }
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
mohamedriaspro
0viewers