我有一个像这样的 HTML
<a href="yourpath/controller/views/username" class="classname">username</a>
如何使用 Prototype.js 按类名读取属性 href
的值。
请给一些建议。
最佳答案
$$('.classname')[0].readAttribute('href');
请注意,$$
将始终返回一个数组。
关于javascript - 在原型(prototype) javascript 中按类名读取属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4223223/