Send data together with form

Asked

Viewed 29 times

0

Complementing my previous question (goo.Gl/rNMK7c) and I want that when clicking the button to fill the form the code take which product the customer was interested, because there will be a button for each item, When the client click on the button that in the image this as contact is informed in the form which item he was interested, where the arrows are, has how to do without php, I haven’t studied yet, know little, follow the print of the site I’m doing prntscr.com/ghgf8p

1 answer

0

$('button').on('click', function(){
  $('#id').val($(this).attr('data-id'))
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form>
   <input type="text" id="id" placeholder="ID">
   <input type="text" placeholder="nome">
</form>

<button data-id="1">Primeiro item</button>
<button data-id="2">Segundo item</button>

I didn’t quite understand your doubt, but I believe it’s something like that.

  • Rafael Augusto sorry to be unaware, but where I put this code, when you click the button you have to open a form where the customer will enter your data and send,:

  • Button: <a href="javascript:void(0)" onclick="window.open('form.html', 'Page', 'STATUS=NO, TOOLBAR=NO, LOCATION=YES, DIRECTORIES=NO, RESISABLE=YES, SCROLLBARS=YES, TOP=90%, LEFT=280%, WIDTH=485, HEIGHT=545');">img src='images/button-contact.png'></a>

  • form.html <! -- Do not change the code! --> <a id="foxyform_embed_link_181315" href="http://br.foxyform.com/">foxyform</a> <script type="text/javascript"> (Function(d, t){ var g = d.createelement(t), s = d.getelementsbytagname(t)[0]; g.src = "http://br.foxyform.com/js.php?id=181315&sec_hash=e727220c0f2&width=445px&heigth=525px"; s.parentNode.insertBefore(g, s); }(Document, "script"); </script> <! -- Do not change the code! -> </body> </html>

  • I will probably need to change this form as I’ve already got a plugin type ready.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.