to start with... a <button> doesn't "toggle"
you want the click event there
then you'll want to do a check to see if the <li> is blue, if it is,
remove blue, otherwise add it
better use, use a CSS class with "color: blue"
.blue { color: blue; }
then you can say
$('#jqdt').find('ol li:eq(0)').toggleClass("blue");
On Jan 11, 5:45 pm, JQueryNewbie <[email protected]> wrote:
> I cant get my color change on my listitem. any help would be
> appreciated. Thanks in advance.
>
> <head>
> <title></title>
>
> <script src="scripts/jquery-1.3.2.js" type="text/javascript"></
> script>
> <script type="text/javascript">
> $(document).ready(function() {
> $("dt-link1").toggle(function() {
> $('#jqdt').find('ol li:eq(0)').css("color","Blue");
> return false;
> });
> });
> </script>
>
> </head>
> <body>
>
> <div id="jqdt">
> <ol>
> <li>list item 1 with dummy link to silly.pdf </li>
> <li>list item 2 with class="goofy" </li>
> <li>list item 3 SURPRISE! </li>
> <li>list item 4 with silly link to silly.pdf </li>
> </ol>
> </div>
>
> <br/>
> <button id="dt-link1" type="button">toggle first list item</button>
> <button id="dt-link2" type="button">toggle first li even</button>
>
> </body>