There is a pop-up window with a contact form in which there is an input. Its value should be changed depending on the button that the user clicked on. For what I decided to use the data- * value.
The solutions I tested from the open spaces do not work. For example, this:
<a data-auto="1123" class="btn-success">Заказать</a> <form> <input id="someuniqid" type="text" readonly> <input type="submit" value="Отправить"> </form> <script> $('a.btn-success').on('click',function(){ var mysuperdata = $(this).attr('data-auto'); $('input#someuniqid').val(mysuperdata); alert("ох ты ж епт"); }); </script> Please tell me how to do it wisely and / or why the solution does not work.