"and the others show error"

Because as the error says, ".title" and ".href" are not valid
operations on a jQuery object

you should use

$("a").attr("title")  and $("a").attr("href");

if you want to get those from your jQuery wrapped object

On Oct 16, 12:04 am, blacque <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
> I use jquery 1.2.6. I'd like to get some attributes from a tag, but i
> get some errors. Here's the jquery script:
>
> $(document).ready(function() {
>         alert($("a").href());
>         alert($("a").text());
>         alert($("a").title());
>
> });
>
> And the html is here:
>
> <a href="the href" class="myclass" title="the title">testing</a>
>
> The script only works for $(''a").text(), and the others show error.
> Can anyone help me, why is it happen?Thanks a lot before..

Reply via email to