Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <input data-max="3" type="text">
  <input data-max="4" type="text">
  <input data-max="5" type="text">
  <input data-max="6" type="text">
  <input data-max="4" type="text">
  <input data-max="5" type="text">
</body>
</html>
 
$(function() {
  $(document).on('input', 'input[type="text"]', function(event) {
    if($(this).data("max") < $(this).val().length) {
      $(this).css("border", "1px solid red");
    } else {
      $(this).css("border", "");
    }
  });
});
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers