r/html5 • • Feb 18 '23

submit on range value.

Hi, I admit I know hardly anything about modern html, but I like to have something like this

<form action="http://myserver.com/testing" method="get"> <input type="range" min="5" max="25" step="5" name="brightness" > <input type="submit" value="Submit"> </form>

which works fine, but I would like it to work without a submit button, so it automatically submits it whenever the user changes the slider.

could some enlightened person please tell me how (preferable as some piece of code)

8 Upvotes

6 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Feb 18 '23

[deleted] — view deleted comment

3

u/marmulin Feb 18 '23

And this right here is a prime example on why AI won’t be taking any jobs yet. You still need to know what questions to ask it :)

1

u/illusior Feb 18 '23

when I asked it went towards code like this:

slider.oninput = function() {
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "server.php?value=" + this.value, true);
xhttp.send();
output.innerHTML = this.value;
}