I'm a new in JavaScript can someone help and tell me why button doesnt work? The problem: I need to make a custom form so i made 2 forms: First form must be hidden and recieve data from custom form which is visible for a user. Site is made on Tilda, so I created in two zero blocks two forms, for every data type I made its own variable name. I can't understand where is mistake in code visible form looks like this with variables hidden form looks like this with variables
<style>
/*скрываем блок с настоящей формой*/
#rec458182238 .t-submit {
display:none;
}
/*скрываем кнопки фейковых форм*/
#rec458182486 .t-submit {
display:none !important;
}
</style>
<script>
$('.tn-elem__4581824861655189562979').click(function() {
$('select[name="pomeshenie"]').val($('select[name="pomeshenie_1"]').val()); //выпадающий список
$('input[name="square"]').val($('input[name="square_1"]').val()); //инпут (поле в одну линию)
$('input[name="izveshatel"]').val($('input[name="izveshatel_1"]').val()); //инпут (поле в одну линию)
$('input[name="name"]').val($('input[name="name_1"]').val()); //инпут (поле в одну линию)
$('input[name="phone"]').val($('input[name="phone_1"]').val()); //инпут (поле в одну линию)
$('#rec458182238 .t-submit').trigger('click'); //клик по кнопке "настоящей" формы
});
</script>
So my questions are: Why button dosnt work? Look at picture please what is right to type in before .click(function()? What string of code should I add to add checkboxes in data to recieve from a user.