it's not toggle()'s fault :-}
you are not triggering the click for your 'thing' element view
example:
http://docs.jquery.com/Attributes/toggleClass#class
$("p").click(function () {
$(this).toggleClass("highlight");
});
or in your case:
$(#thing).click(function({
$(#resultsview).removeClass('list');
...etc
On Sep 10, 6:34 am, unremarkable <[EMAIL PROTECTED]> wrote:
> Hi—and excuse me, I'm a newbie. :)
>
> I want to toggle the CSS class of a section (I can't toggle the ID,
> right?). I have, in short:
>
> -----------------------------------------------------------------------
>
> <style>
> .gallery {background:red;}
> .list {background:green;}
> </style>
>
> <script language="javascript" type="text/javascript">
> $(document).ready(function(){
> $("#thing").toggle(
> function () {
> $(#resultsview).removeClass('list');
> $(#resultsview).addClass('gallery');
> },
> function () {
> $(#resultsview).removeClass('gallery')
> $(#resultsview).addClass('list');
> });});
>
> </script>
>
> <p id="thing">click</p>
> <ul id="resultsview" class="list">
> <li>blah</li>
> <li>blah</li>
> </ul>
>
> -----------------------------------------------------------------------
>
> …and it doesn't work; what am I doing wrong?
>
> Thank you in advance!
>
> unxx
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---