JSFiddle - React, Tailwind, and code Playground

HTML

<a href="http://www.w3.org/TR/2011/WD-html5-20110405/association-of-controls-and-forms.html#attr-fae-form">About attribute "form" of "input" in HTML5</a>
<form id="formid1">
    <input type="text" name="n" />
</form>

<form id="formid2">
    <input type="text" name="n2" form="formid1" />
    <input type="text" name="n2" form="formid3" />
</form>

<div id="result"></div>

JavaScript

var first = $('form input').eq(0).attr('form'); // non exists attr
var second = $('form input').eq(1).attr('form'); // attr with existing form
var third = $('form input').eq(2).attr('form'); // attr with non existing form
var anyattr = $('form input').eq(2).attr('sadf'); // non exists attr


$('#result').html(typeof first + ' (' + $(first).attr('id') + ')<br />' +
                typeof second + ' (' + $(second).attr('id') + ')<br />' +
                 typeof third + ' (' + $(third).attr('id') + ')<br />' +
                 typeof anyattr + ' (' + $(anyattr).attr('id') + ')');