最佳答案
I need to get a reference to the FORM parent of an INPUT when I only have a reference to that INPUT. Is this possible with JavaScript? Use jQuery if you like.
function doSomething(element) {
//element is input object
//how to get reference to form?
}
This doesn't work:
var form = $(element).parents('form:first');
alert($(form).attr("name"));