You need quotes around all selectors.  So $(#resultsview) should be $
("#resultsview")

Also, I would download/use Firebug, as it will provide meaningful
error messages in the console which you will learn and/or can paste to
forum messages like this...

-Nate



On Sep 10, 9:46 am, unremarkable <[EMAIL PROTECTED]> wrote:
> Hi—a simple question from a newbie for you!      :)
>
> I am trying to toggle the .class of an element (I can't toggle the
> #id, right?). However, what I have is not working. 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>
> </li>
>
> -----------------------------------------------------------------------
>
> What am I doing wrong? Thanks for any advice!
>
> unxx

Reply via email to