How to check if a form has no input fields and if so set the focus to an anchor element
<p>Is there any way to check if a specific form has any input fields in it? Or if it has no input fields?</p>

<p><strong>Update:</strong></p>

<p>Also how do I return the focus to a button on page load if the condition is met?
The below doesn't seem to work</p>

<pre><code>var numInputs = $("#forgotPassword").find("input:visible").length;
if(numInputs == 0){
$('.button-class &gt; a').focus(); 
}
</code></pre>
