<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CodePen</title>
</head>
<body>
<div class="card bg-light">
<div class="card-body text-right">
<textarea class="form-control"></textarea>
<br/>
<span>280</span>
<button class="btn btn-primary">Tweet</button>
</div>
</div>
</body>
</html>
// Initially disable the button
$("button").prop("disabled", true);
// When the value of the text area changes...
$("textarea").on("input", function() {
$("span").text(280 - $(this).val().length);
// If there's at least one character...
if ($(this).val().length > 0) {
// Enable the button.
$("button").prop("disabled", false);
} else {
// Else, disable the button.
$("button").prop("disabled", true);
}
});