jQuery - Traversing the DOM

Posted by danit on Stack Overflow See other posts from Stack Overflow or by danit
Published on 2010-03-29T09:53:12Z Indexed on 2010/03/29 11:03 UTC
Read the original article Hit count: 111

Filed under:

Here is my HTML:

                    <li>
                        <div class="menu_inner">
                            <a href="#">
                                <div class="button"><img class="486" src="images/portalbutton.png" /></div>
                                <div class="prod_description">&nbsp;</div>
                            </a>
                        </div>
                    </li>

I want to add a .click() function to .prod_description, the click event should take the background colour applied in CSS from the li element.

Using this code:

$(".prod_description").mousedown(function() {
    $('#toolbar').css('background-color', $(this).parent().css('background-color'))
})

I dont seem to be able to get the correct $(this).parent() combination....

© Stack Overflow or respective owner

Related posts about jQuery