title: How to pre default a select field with jQuery on page load
body: <p>I have had a developer create some code below in my wordpress footer.php file to predefault a set of fields based on the user's profile.</p>
  
  <p>The text fields seem to default fine however the select option (gender) does not default and the user has to select this option, even though the value is stored against their profile. </p>
  
  <p>Is there a way to update this code to have the gender default? I think it is something to do with using .val()??</p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;?php
  $current_user = wp_get_current_user();
  
  
  /**
   * @example Safe usage: $current_user = wp_get_current_user();
   * if ( !($current_user instanceof WP_User) )
   *     return;
   */
  $username = $current_user-&gt;user_login;
  $email = $current_user-&gt;user_email;
  $firstname = $current_user-&gt;user_firstname;
  $lastname = $current_user-&gt;user_lastname;
  $displayname = $current_user-&gt;display_name;
  //$user_id = $current_user-&gt;phone;
  
  
  
  
  if ( is_user_logged_in() ){
  global $current_user;
  get_currentuserinfo();
  $email = $current_user-&gt;user_email;
  $name  = $current_user-&gt;user_firstname.' '.$current_user-&gt;user_lastname;
  $golflink = $current_user-&gt;dbem_golf_link;
  $home_club = $current_user-&gt;dbem_home_club;
  $handicap = $current_user-&gt;dbem_handicap;
  $gender = $current_user-&gt;dbem_gender;
  }
      ?&gt;
  
  
  jQuery( document ).ready(function() {
  
  jQuery('#attendee_name').val("&lt;?php echo $firstname.' '.$lastname; ?&gt;");
  jQuery('#golflink').val("&lt;?php echo $golflink; ?&gt;");
  jQuery('#home_club').val("&lt;?php echo $home_club; ?&gt;");
  jQuery('#handicap').val("&lt;?php echo $handicap; ?&gt;");
  jQuery('#gender').val("&lt;?php echo $gender; ?&gt;");
  </code></pre>
  
  <p>Any advice would be great.</p>
  
  <p>From other reading, can I just change:
      jQuery('#gender').val("");
  to 
      jQuery('select#gender').val("");</p>
  
  <p>I tried the above but no changes. </p>
  
  <p>The select I created in wordpress was 'Male' and 'Female'</p>
  
  <p>Thanks</p>