I have a HTML that looks like this:
<tr>
<td nowrap="nowrap">
<a href="/home" class="mainlevel_jos_mainmenu_menu" >Home</a>
<a href="/somethingelse" class="mainlevel_jos_mainmenu_menu" >Something Else</a>
<a href="/somethingelse2" class="mainlevel_jos_mainmenu_menu" id="active_menu_jos_mainmenu_menu">Something Else 2</a>
<a href="/somethingelse3" class="mainlevel_jos_mainmenu_menu" >Something Else 3</a>
<a href="/somethingelse4" class="mainlevel_jos_mainmenu_menu">Something Else 4</a>
</td>
</tr>
and i nee开发者_StackOverflow社区d to hide the Element a with content Home, either by href (because its the only element with this href on page) or by content (which is always "Home").
But the problem is, i can not add ID to Home.
Using jQuery:
First element
$(".mainlevel_jos_mainmenu_menu:first").hide();
By content
$(".mainlevel_jos_mainmenu_menu:contains('Home')").hide();
By href
$(".mainlevel_jos_mainmenu_menu[href='/home']").hide();
Using jQuery:
$('a[href="/home"]').hide();
you can use jquery's hide by giving class name which you have
give one more class name to the home like test
<a href="/home" class="mainlevel_jos_mainmenu_menu test" >Home</a>
$(".test").hide();
for more details see here
http://api.jquery.com/hide/
精彩评论