<form id="peredat-2"method="post" enctype="multipart/form-data" novalidate="novalidate"> <input type="tel" name="vfb-27"> <input type="tel1" name="vfb-28"> <input type="tel2" name="vfb-29"> <input type="tel3" name="vfb-30"> <input type="tel4" name="vfb-31"> <input type="submit" name="vfb-submit" id="vfb-9" value="Отправить" class="vfb-submit "> </form> 

How to do that when you click on the button

 <input type="submit" name="vfb-submit" id="vfb-9" value="Отправить" class="vfb-submit "> 

all data was inserted into

 <textarea maxlength="300" onkeyup="rcl_chat_words_count(event,this);" id="chat-area-15" name="chat[message]"></textarea> 

Thank you very much in advance for your help!

    1 answer 1

     $("#vfb-9").click(function(e) { var values = []; $(this).closest("form").find("input,select,textarea").each(function(){ if (this.type != "hidden" && this.type != "submit") values.push($(this).attr("name") + "=" + $(this).val()); }); var value = values.join("\n"); $("#chat-area-15").val(decodeURIComponent(value)); return false; }); 
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <form id="peredat-2" method="post" enctype="multipart/form-data" novalidate="novalidate"> <input type="tel" name="один" value="aaa"> <input type="tel1" name="два" value="bbb"> <input type="tel2" name="три" value="ccc"> <input type="tel3" name="четыре" value="ddd"> <input type="tel4" name="vfb-31" value="eee"> <input type="submit" name="vfb-submit" id="vfb-9" value="Отправить" class="vfb-submit "> </form> <textarea maxlength="300" id="chat-area-15" name="chat[message]"></textarea> 

    • I was wrong, not all data, but the name of the field and the value - Never3D
    • @ Never3D and what did I do? - Igor
    • Aha checked, you can make it so that instead of & were enter, and the name value, you could write in Russian, otherwise I have krakozyabry - Never3D
    • @ Never3D is easy :) - Igor
    • Great at all, the last little question is how to remove these _wp_http_referer, vfb-spam =, _ vfb-secret =, form_id = 2. So that they do not take into account - Never3D