> But it doesn't work, it returns href of tag a instead a object.

Actually, it does work -- it's just that the default behavior of the
HTMLAnchorElement when you try to use it as a string is to return the
href (e.g., the result of its toString method), and `alert` does
exactly that. You can see that it's an anchor element by changing your

        // alerts "typeof = object"
        alert("typeof = " + typeof anchor);

        // alerts "Object.toString = [object HTMLAnchorElement]"
        alert("Object.toString = " +

        // alerts "HTMLAnchorElement.toString = (the href)"
        alert("HTMLAnchorElement.toString = " + anchor.toString());

T.J. Crowder
Independent Software Consultant
tj / crowder software / com

On Jul 16, 7:37 am, Quyết Tiến <doquyett...@gmail.com> wrote:
> I have a page html like this:
> <div id="content" style="padding: 100px;">
> <a href="#"> rel="dhtmlwindow">content</a>
> <div rel="dhtmlwindow">content</div>
> <a href="#" rel="dhtmlwindow";>content</a>
> <a href="#" rel="dhtmlwindow">content</a>
> </div>
> I want to select all tag a has rel is dhtmlwindow and this is code:
> $('content').select('a[rel="dhtmlwindow"]').each(function(anchor) {
> alert (anchor);
> });
> But it doesn't work, it returns href of tag a instead a object.

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to