Grow your CSS skills. Land your dream job.

jQuery list

  • # December 3, 2009 at 10:49 pm

    I have thought about eliminating anchors from my site menu. I have tested it and it works fine.

    Code:
    $(“#nav ul li”).click(function(){
    window.location = $(this).attr(“class”);
    });

    and the HTML would be
    <li class="somepage.html">Some page</li>

    and it would link to somepage.html

    would this be bad practice?
    and what would the cons be? (other than someone disabling their javascript and links being unclickable)

    # December 4, 2009 at 1:39 pm

    I don’t know, but I am curios as to what the purpose of the code is. What does it do?

    # December 4, 2009 at 3:54 pm

    I think it’s bad practice. A class atrribute is suppose to store class infromation, certainly not an anchor. Plus, why would you want to remove the need of anchor tag ? They’re here for a reason, use them :)

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".