Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript jQuery list

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #27069
    Makeshift
    Member

    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)

    #67513
    cybershot
    Participant

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

    #67527
    Hawke
    Member

    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)
  • The forum ‘JavaScript’ is closed to new topics and replies.