How to Skip ReadOnly and Disabled inputs while using .focus()
<p>how would this code be modified so it does not <code>.focus()</code> the first form object if it is <code>readonly</code> or <code>disabled</code> and to skip to the next form input for focus?</p>

<p>Currently it returns an error if the first input box is disabled, but i would also like to skip to the next input box if it's readonly too, and if all inputs are disabled and readonly, then it should not focus anything.. </p>

<pre><code>    &lt;script language="javascript" type="text/javascript"&gt;
    // Focus first element
    $.fn.focus_first = function() {
      var elem = $('input:visible', this).get(0);
      var select = $('select:visible', this).get(0);
      if (select &amp;&amp; elem) {
        if (select.offsetTop &lt; elem.offsetTop) {
          elem = select;
        }
      }
      var textarea = $('textarea:visible', this).get(0);
      if (textarea &amp;&amp; elem) {
        if (textarea.offsetTop &lt; elem.offsetTop) {
          elem = textarea;
        }
      }

      if (elem) {
        elem.focus();
      }
      return this;
    }
    &lt;/script&gt;
</code></pre>

<p>Actually using <code>input:enabled:visible</code> fixes alot of my issues, but i'm still trying to figure out if readonly, to skip to the next one.</p>
