title: How to write DRY code when working $(this) and $each for form inputs
body: <p>I've written some code which enables and disables input and select fields on a series of forms. I have repeated a lot of code and I wanted to know how I would write this in a DRY, scalable way. </p>
  
  <p>I created a Fiddle and and it repeats three times - edit, cancel and save.</p>
  
  <pre><code>$(edit).each(function(){
  
  $(this).on('click', function(){ }); });
  </code></pre>
  
  <p>Here is my fiddle.</p>
  
  <p><a href="https://jsfiddle.net/tellmehow/5tcs6f82/9/" rel="nofollow">https://jsfiddle.net/tellmehow/5tcs6f82/9/</a></p>
  
  <p>I will keep working on this, but if anyone has any pointers or a similar Fiddle, please let me know.  Thanks.</p>