具体来说,我需要为这个等效的选择,它在原型1.5.0工作:什么是'document.getElementsByClassName'的Prototype 1.6.0+等价物?
//for each element with class of 'myClassName' and an ancestor with id='myElementID'...
document.getElementsByClassName('myClassName', $('myElementID')).each(...);
我尝试这样做:
$$('myElementID input.myClassName').each(...); //Because I will be selecting input elements with this class
这:
$$('myElementID .myClassName').each(...); //Trying to get all child elements with this class name
我得到一个空的清单每次。我想要的孩子元素不一定是直接的孩子,所以我知道>
角色将无法工作。
我不使用原型,也无法找到有关此确切问题的帮助。任何帮助表示赞赏。
这个问题的确唤起了许多回忆。 Prototype是我学习/使用的第一个JS库 –