> Nobody actually does plain “JavaScript” programming for the web anymore, not really anyway. Do they use the core language? Yes. But we no longer use any of the built-in JavaScript->HTML functionality directly.
Which is sort of a shame because there's stuff in there that totally obviates the need to haphazardly traverse the dom with jQuery.
Finding the form an input element belongs to in jQuery:
$('input').parents('form');
// or probably
$('input').parent().parent().parent().find('form');
Finding the same thing using the DOM API: document.querySelector('input').form;
You'd want to mix those two, in a real use case: $('input').on('click', function(evt) {
var form = this.form;
});
Then you don't even need jQuery to use the FormData API: // where `submit` uses XHR2 to make a request
<input type="submit" onclick="submit(this.form)">