views:

198

answers:

4
+2  A: 

You will run into problems when ID'ing 2 list items as the same ID. If you want the same CSS to apply to both, use classes instead.

patricksweeney
sorry that was a typo, fixed it thanks.
+7  A: 
$("li:first").click(function() {
    $(this).children("div").hide();
});
Stuart Branham
A: 

Having two identical IDs is invalid xHTML

Not sure about the exact jQuery syntax

but in sudo code would be something like:

li1 addEvent('click')
{

get child of li1, filter by class c1
set style on child(display, none)
}

Cato Johnston
+1  A: 

this might work for you:

note: make sure you include the jquery.js, i was lazy and didnt put it in here.

<html>
<head>
<script type="text/javascript" language="javascript">
$(document).ready(function(){

    $(".clickableLI").click(function(){
        $(this).find("div").hide();    
    });

});
</script>

</head>
<body>
    <ul>
        <li class="clickableLI">
             <div class="c1"></div>
        </li>
        <li class="clickableLI">
             <div class="c1"></div>
        </li>
    <ul>

</body>
</html>
John Boker