treehouse : what would you like to learn today?
Web Design Web Development iOS Development

jQuery list

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

    $(\"#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)
  • I don't know, but I am curios as to what the purpose of the code is. What does it do?
  • 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 :)