Search code examples
javascriptmootools

get specific element inside an element with Mootools


I have a Mootools element which is a HTML LI element. Inside of it, (child of child), somewhere, there is an input element.

How can I find with Mootools, the input element inside of the li element and retrieve it ?

 var input = li. ...

Solution

  • You can use var input = li.getElement('input');, that will return the first input it finds. .getElement is kind of the MooTools querySelector before it existed, so it takes a CSS selector.

    You might want to use a more specific CSS selector if there are several inputs though.