I’m new to Javascript and Mootools and am having a bit of trouble understanding some things, especially since the documentation on Mootools is, shall we say, lacking at best.
My question is regarding the $ selector.
Why is it that I can chain some properties to it, and not others?
For example why does
$('results').style.border = "1px solid #000000";
work, but
$('results').innerHTML = "foo";
does not?
Thanks in advance.
The first example is not really an example of “chaining”.
styleis a DOM-standard object representing the CSS style of an element. It has nothing to do with MooTools – it’s just standard dot notation for accessing properties of objects.“Chaining” is when the result of an operation on an object returns the object itself after the operation, allowing you to do stuff like this:
Lastly, that second example ought to work. You should post the actual source.