从没有ID的HTML输入和没有名称的HTML输入中读取数据

发布于 2025-01-29 06:26:42 字数 632 浏览 3 评论 0原文

我有一个包含多个输入的表的HTML页面。我想从输入中获取数据,但是它们没有ID或名称。

如果分析DOM,我可以看到每个输入都有不同的属性。它有一个属性$ h:2029和一个tkpid:“ 554”。有没有办法阅读这些属性?

输入的代码如下:

“输入屏幕副本”

如果我检查'tkpid'属性是一种非规范属性:

 let input = document.querySelector('input');
  input.hasAttribute('tkPid');  \\ Response: false

非常感谢您

I have an html page with a table that contains several inputs.I want to take the data from the inputs, however they do not have id or name.

If I analyze the DOM I can see that each input has different properties. It has a property $H: 2029 and a tkPid:"554". Is there a way to read through these properties?
DevTools screenshot

The code of the input is the following:

input screen copy

If I check 'tkPid' property exists as a non-regular attribute:

 let input = document.querySelector('input');
  input.hasAttribute('tkPid');  \\ Response: false

Thank you very much

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

滥情稳全场 2025-02-05 06:26:42

最后,他能够阅读并处理描述的属性如下:

 document.getElementsByClassName('v-textfield v-widget align-right v-textfield-align-right v-has-width v-has-height')[3].tkPid /// Result: 554 

感谢您的兴趣#Lee Taylor

Finally he was able to read and treat the described properties as follows:

 document.getElementsByClassName('v-textfield v-widget align-right v-textfield-align-right v-has-width v-has-height')[3].tkPid /// Result: 554 

Thanks for your interest #Lee Taylor

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文