Also, 'id' is not a good attribute to store random data, first of all,
they must be unique. Imagine 2 cells link to the same URL.
Depends on the situation, but IMO, the attribute 'title' is better for
this. Or 'rel' if it's an anchor. Just bear in mind that the title
will be visible to the user. In this case that seems to be actually
good.

Ariel Flesler

On 8 nov, 14:15, "Ambient.Impact" <[EMAIL PROTECTED]> wrote:
> One way to do this would be to include a link (<a
> href="www.google.com">Google</a>) in a table cell with a class (so you
> can find it) in your HTML. Then, when the page loads, grab the URL
> from the href attribute of the link, and remove the table cell
> containing the link. This way you get very good marks in the
> unobtrusive area: the URL is available in case JavaScript isn't on (or
> jQuery doesn't load for some reason), and they get an improved
> experience with JavaScript and jQuery.
>
> Glad to see someone interested in unobtrusive scripting, 'tis the
> right way to go. :)
>
> On Nov 8, 10:26 am, Brad F <[EMAIL PROTECTED]> wrote:
>
>
>
> > I'm trying to figure out the best way to pass variables into jQuery
> > using unobtrusive javascript...
>
> > For example:
>
> > Clicking a column row takes you to a URL.
> >         <table>
> >                 <tr class="addNavigation" id="http://www.google.com";>
> >                         <td>blah</td>
> >                 </tr>
> >         </table>
>
> > ---
>
> >         $("tr.addNavigation").click(function() {
> >                         window.location=$(this).attr("id");
> >                         return false;
> >                 });
>
> > As you can see, this uses the ID tag of the TR element but this is not
> > a very good solution.  What if two rows go to the same URL?  Then I'm
> > breaking a major rule with ID's (that they shouldn't be duplicated
> > across a page)...
>
> > Anyone have any ideas as I'm fairly new to jQuery and completely
> > unobtrusive code.- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -

Reply via email to