I don’t think it would be used here because I’m not submitting anything.
All I’m doing is capturing individual user inputs. And inputs can be used without forms.
sent.addEventListener("click", function(evt) {
player.src = value.value;
player.volume = 1.0;
// Prevent default form handling (which would reload the page, in this case)
evt.preventDefault();
});
}());
Yes that’s called graceful degradation. When js is enabled you don’t want the form to submit.
If no js is present then post the form and handle all the changes serverside and return the page in its new state.
As I said its not invalid to have controls outside of a form especially if you are not going to handle the serverside implications but just beware that some users do not have js enabled. It’s not so much of an issue these days but what you need to do is make your page work without JS first and then enhance it with js afterwards and then you are on the right track.