scratch the append(<input line. That's me starting to find solutions:

$(document).ready(function() {
        $('#searchLabels').addClass('active'); // allows me to style the
radio buttons differently when JS is enabled
        $('#searchLabels :radio[id]').click( function() {
                var selectedInput = $(this).attr("id");
                $('#searchLabels label').removeClass("selected");
                $('#searchLabels label[for="' + selectedInput +
'"]').addClass("selected");
        });
});


On Dec 5, 4:26 pm, sperks <[EMAIL PROTECTED]> wrote:
> The site's live, (http://deliciouslivingmag.com/) and I got the search
> tabs working beautifully, but forgot to check Safari after the final
> change.
> Grrrr.
> Does anyone know if / how I can get Safari to understand that I'm
> clicking on the radio even when I'm clicking on the label (assuming
> that's the issue).
>
> $(document).ready(function() {
>         $('#searchLabels').addClass('active'); // allows me to style the
> radio buttons differently when JS is enabled
>         $("#searchLabels").append('<input type="hidden" name="cat" value="" 
> />');
>
>         $('#searchLabels :radio[id]').click( function() {
>                 var selectedInput = $(this).attr("id");
>                 $('#searchLabels label').removeClass("selected");
>                 $('#searchLabels label[for="' + selectedInput +
> '"]').addClass("selected");
>         });
>
> });
>
> Cheers
> Steve
>
> On Dec 3, 1:17 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote:
>
> > Hi sperks,
>
> > I'm pretty sure you can do that by changing this line ...
>
> > $('div#searchLabels label.attr("for","' + selectedInput +
> > '")').addClass("selected");
>
> > to this ...
>
> > $('#searchLabels label[for=' + selectedInput +
> > ']').addClass("selected");
>
> > Instead of returning the attribute itself, you want to incorporate the
> > attribute selector, [attribute=value], to the expression.
>
> > I also removed the "div" from in front of #searchLabels, because most
> > likely there is no need for it.
>
> > Hope that helps.
>
> > --Karl
> > _________________
> > Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> > On Dec 3, 2007, at 12:39 PM, sperks wrote:
>
> > > I think that this bit of script is adding a class to the for
> > > attribute, but I'm wanting to add the class to the element that has
> > > that for attribute.  Can anyone help me do the targeting better?
> > > Thanks
>
> > > $(document).ready(function() {
> > >    $('div#searchLabels').addClass('active'); // allows me to style the
> > > radio buttons differently when JS is enabled
> > >    $('div#searchLabels :radio[id]').click( function() {
> > >            var selectedInput = $(this).text();
> > >            $('div#searchLabels label').removeClass("selected");
> > >            $('div#searchLabels label.attr("for","' + selectedInput +
> > > '")').addClass("selected");
> > >    });
> > > });

Reply via email to