WP Contact Form 7 Split/Separate fields

Step-1: Add 2 hidden fields to the contact form

[hidden your-first-name id:first-name-p]
[hidden your-last-name id:last-name-p]

Step-2: Write below jquery script in the footer

$("#name_field_id").focusout(function(){
     str = $(this).val();
     if(str){
      s = str.split(/(?<=^\S+)\s/); //split string in name field after first space found. 
      $("#last-name-p").val(s[1]); //s[1] value after the first space set to hidden field.
     }
  });

Output will be list this:-

about author

Sam

samatwwc@gmail.com

WebDeveloper, Php, MySQL, WordPress, Magento, cPanel, Plesk, WHM, WooCommerce

Leave a Reply

Your email address will not be published. Required fields are marked *