wcodavid
wcodavid

Reputation: 127

list menu underline for each page

<ul>
<li><a href="/product/list.html?cate_no=1">menu 1</a></li>
<li><a href="/product/list.html?cate_no=2">menu 2</a></li>
<li><a href="/product/list.html?cate_no=3">menu 3</a></li>
</ul>

using jquery, if I click menu 1, I want to make underline on list "menu 1". and if click menu 2, show underline on only "menu 2".

Upvotes: 1

Views: 280

Answers (1)

lanes
lanes

Reputation: 1937

CSS:

a {
    text-decoration: none;
}

jQuery:

$("a").on( "click", function(event) {
    event.preventDefault();
    $("a").css( "text-decoration", "none" );
    $(this).css( "text-decoration", "underline" );
});

Upvotes: 0

Related Questions