title: How do I combine two jQuery event handlers in to one?
body: <p>My problem is that I have two event handlers who do the same thing but for different objects. Could someone tell me how to do this.</p>
  
  <pre><code>$('.url1').keyup(function() {
    var limit = 60; // Maximale Anzahl an Zeichen
    var count = $(this).val().length;
  
    $('.counter').html(count);
    if (count &gt; limit) {
      $(this).css('border-color', 'crimson');
    } else {
      $(this).css('border-color', 'ForestGreen');
    }
  
  });
  
  $('.title1').keyup(function() {
    var limit = 45; // Maximale Anzahl an Zeichen
    var count = $(this).val().length;
  
    $('.counter').html(count);
    if (count &gt; limit) {
      $(this).css('border-color', 'crimson');
    } else {
      $(this).css('border-color', 'ForestGreen');
    }
  });
  </code></pre>