Michael,

I had to change some things but this works...


<script>
$(function(){

$('#switcher .section').click(function() {
        $('#switcher .section').removeClass('highlight');
        $(this).addClass('highlight');

});

});
</script>




On Feb 15, 8:46 am, Michael Price <[EMAIL PROTECTED]> wrote:
> yabadowrote:
> > <div id="section" class="section1"> Stuff </div>
> > <div id="section" class="section2"> Stuff </div>
> > <div id="section" class="section3"> Stuff </div>
> > <div id="section" class="section4"> Stuff </div>
> > <div id="section" class="section5"> Stuff </div>
>
> If this isn't pseudo-code then you've got your IDs and classes the wrong
> way round here, I think.......
>
> Anyway, the way I usually do it (and someone will be along shortly with
> a better method, I don't doubt, but it works for me) is have the CSS for
> the highlight in a new class. Then on click I REMOVE this class from all
> of them, then I ADD the class to the clicked DIV. Code for basic idea
> follows:
>
> $(".section").click(function() {
>         $(".section").removeClass(".highlight");
>         $(this).addClass(".highlight");
>
> }
>
> jQuery being what it is, there's bound to be a way of doing
> this in one line, though :)
>
> Regards,
> Michael Price

Reply via email to