Make A List Item Clickable (HTML/CSS)

后端 未结 8 2036
北恋
北恋 2020-12-03 05:26

So I\'m trying to make each list-item on my site clickable but I\'m not sure what is the best way to do it. Please help me out.

So here is the relevant HTML:

8条回答
  •  天涯浪人
    2020-12-03 06:11

    Here is a working solution - http://jsfiddle.net/STTaf/

    I used simple jQuery:

    $(function() {
        $('li').css('cursor', 'pointer')
    
        .click(function() {
            window.location = $('a', this).attr('href');
            return false;
        });
    });
    

提交回复
热议问题