JSFiddle - React, Tailwind, and code Playground
HTML
<form id="frm1">
<input id="input1" value="aaa" />
</form>
<form id="frm2">
<input id="input1" value="bbb" />
<a id="link1" href="#"target="_self" title="13083536911 BOBBI L. MENG looooooooooooooooooooooooooong name">aaa</a>
</form>
JavaScript
function getFieldByForm(anyForm, fieldId) {
if(typeof(anyForm) == "string")
anyForm = $("#" + anyForm);
return anyForm.find("#" + fieldId);
}
alert(getFieldByForm("frm1", "input1").val());
alert(getFieldByForm($("#frm2"), "link1").val());