It doesn't work to call .click() on an A, if you want to navigate a link's
href. Instead:

window.location = $("td a.menu:contains('Main')").attr('href');

- Richard

On Fri, Aug 14, 2009 at 7:32 PM, S2 <smnthsm...@gmail.com> wrote:

>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
> TR/html4/strict.dtd">
> <html>
> <head>
>   <meta http-equiv="Content-Type" content= "text/html;
> charset=iso-8859-1">
>   <title></title>
>   <script type="text/javascript" src="jquery.js">
>   </script>
>   <script type="text/javascript">
>      $(function(){
>          $("td a.menu:contains('Main')").click();
>      });
>   </script>
> </head>
> <body>
>   <table width="200" border="1">
>      <tr>
>         <th>
>         </th>
>         <th>
>         </th>
>      </tr>
>      <tr>
>         <td>
>            <a class="menu" href="/">Main</a>
>         </td>
>         <td>
>         </td>
>      </tr>
>   </table>
> </body>
> </html>
>
> On Aug 13, 6:32 pm, Jules <jwira...@gmail.com> wrote:
> > $("td a.menu:contains('Main')").click() should work. Can you post the
> > html?
> >
> > On Aug 14, 4:48 am, S2 <smnthsm...@gmail.com> wrote:
> >
> > > This doesn't work in IE or Firefox:
> >
> > > $("td a.menu:contains('Main')").click();
> >
> > > This works in IE:
> >
> > > $("td a.menu:contains('Main')")[0].click();
> >
> > > $("td a.menu:contains('Main')").length is 1
> >
> > > What am I doing wrong?
>

Reply via email to