dimanche 3 juillet 2016

How do I get a non-input element to send with the form?


I have an HTML form. All of the inputs are standard except for the slider. I made the slider out of divs instead of using <input type="range">, so I could add extra functionality and style it easier. How do I get the custom input to be part of the form?

I could've put together a query string and redirected the browser with JavaScript:

window.location.assign("/post?author=" + $("#name").val() + "&rating=" + document.elementFromPoint($("#slider-grabber").position().top + 20, $("#slider-grabber").position().left + 5).innerHTML + "&content=" + $("#content").val());

But that only works for a GET request, and my form sends a POST request.


Aucun commentaire:

Enregistrer un commentaire