开发者

readAttribute by classname in Prototype javascript

I am having a HTML like

<a href="yourpath/controller/views/username" class="classname">username</a>

How to read the attribute href's value by classname using the Prototype.js.

Ple开发者_开发百科ase give some suggestions.


$$('.classname')[0].readAttribute('href');

Note that $$ will always return an array.


$$('.classname').pluck('href');

This will return an array of href values in case you need more than one.


$$('.className')[0].readAttribute('href')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜