perhaps a shorter way
JSON.encode($$('a[href$=mp3]').get('href'));

On 01/03/2010 04:03 AM, Perrin Perrin wrote:
see array.map http://www.mootools.net/docs/core/Native/Array#Array:map

Same function that Aron put up but with map instead of filter.

On Sat, Jan 2, 2010 at 8:54 PM, Aaron Newton <[email protected]
<mailto:[email protected]>> wrote:

    see array.filter

    myLinks.filter(function(link){ return link.get('href'); });


    On Sat, Jan 2, 2010 at 6:50 PM, mmjaeger <[email protected]
    <mailto:[email protected]>> wrote:

        stupid me - sorry - I need to get the hrefs into an array and then
        encode it - thanks for replying

        On Jan 2, 6:44 pm, Aaron Newton <[email protected]
        <mailto:[email protected]>> wrote:
         > DOM elements are not JSON encodable (what would you expect it
        to do with
         > them?).
         >
         >
         >
         > On Sat, Jan 2, 2010 at 6:31 PM, mmjaeger <[email protected]
        <mailto:[email protected]>> wrote:
         > > Hello
         > > I've the following code:
         > > var arr = document.id
        <http://document.id>(document.body).getElements('a[href$=mp3]');
         > > console.log(arr.length); // RETURNS 6
         > > console.log('JSON: ' + JSON.encode(arr)); // RETURNS JUST []
         >
         > > what am I missing?
         >
         > > Thank you





--

------------

http://stereomorph.net

Reply via email to