title: avoiding to duplicate listeners
body: <p>I need to set focus on input and textarea elements of a sortable list.<br>
  Here is my code (1).       </p>
  
  <p>a) When I load the list it works fine because it adds a listener for each input.<br>
  b) When I add a new element to the list it duplicates the listeners.    </p>
  
  <p>How should avoid this?<br>
  Maybe trying to use a single listener on body using event delegation?
  Any ideas?<br>
  thanks</p>
  
  <p>(1)</p>
  
  <pre><code>setTimeout(function () {
      var setFocus = function () {
          $('.ui-sortable').find('input, textarea').click(function () {
              $(this).focus();
          });
      };
      $('.ui-sortable').on('DOMNodeInserted', setFocus);
      setFocus();
  }, 0);
  </code></pre>