我有以下代码:
$('.centering').click(function (e) {
$(".thVal").replaceWith(function () {
console.log(this);
return this.value;
});
$('.editFields').hide();
});
这给med提供了以下输出:
<input class="thVal" width="2" type="text" modelbind="LicenseHolder_LegalPerson_Name" value="Test Oil AB">
5505094091(rad 256)
<input class="thVal" width="2" type="text" modelbind="LicenseHolder_LegalPerson.PrimaryAddress_StreetAddress" value="Testgatan 1">
5505094091
<input class="thVal" width="2" type="text" modelbind="LicenseHolder_LegalPerson_PrimaryAddress_ZipCode" value="50010">
5505094091(rad 256)
<input class="thVal" width="2" type="text" modelbind="x => x_LicenseHolder_LegalPerson_PrimaryAddress_HomeTown" value="Växjö Sverige">
5505094091(rad 256)
<input class="thVal" width="2" type="text" modelbind="" value="0730730037">
当我写console.log(this.value)
时,会显示输入值。但我想访问modelbind-attribute的值,当我写console.log(this.modelbind)
时,我只是未定义。
如何访问该值?