title: jQuery - onClick of nested text-field hover containing <li> dropdown menu
body: <p>I have 2 username/password text fields inside of <code>&lt;li&gt;</code>.  On <code>:hover</code> of the <code>&lt;li&gt;</code> the drop down appears showing the text fields. When the user clicks on the text fields, I want the <code>&lt;li&gt;</code> to have the pseudo class <code>:hover</code> so the the fields remain visible if the mouse is moved outside of the contianing <code>&lt;li&gt;</code>.</p>
  
  <p>I've tried this code but it doesn't work. </p>
  
  <pre><code>&lt;script&gt;$('#username').on('click',function() {
      $('#li').trigger('hover');});
  &lt;/script&gt;    
  </code></pre>
  
  <p>Here is the HTML  </p>
  
  <pre><code>&lt;li id="li"&gt;&lt;a href="#"&gt;Register&lt;/a&gt;&lt;/li&gt;
     &lt;p&gt;Or Login Below&lt;/p&gt;
   &lt;form method="post" action="#" name="loginform" id="loginform" class="myClass"&gt;
  &lt;fieldset&gt;
      &lt;input value="username" type="text" name="username" id="username" onclick="this.value=''" class="left" /&gt;
      &lt;input value="password" type="password" name="password" id="password" onclick="this.value=''" class="left" /&gt;
      &lt;input type="submit" name="login" id="login2" value="Login" /&gt;
  &lt;/fieldset&gt;
  &lt;/form&gt;  
  &lt;/li&gt;
  </code></pre>
  
  <p>Is the JavaScript wrong or is it possibly conflicting with other JavaScript?<br>
  Also, would it be easy to make it so 'clicking of the <code>&lt;div&gt;</code> makes the <code>:hover</code> go away, thus hiding the <code>&lt;li&gt;</code>?</p>