Created
November 12, 2014 23:22
-
-
Save kayhadrin/e05bdb3e0c8fae5524a7 to your computer and use it in GitHub Desktop.
A Pen by David.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<span> | |
<a class="menu-item">Home</a> | |
</span> | |
<span> | |
<a class="menu-item">Contact</a> | |
</span> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ // make sure that you run the code when the page DOM elements are ready | |
$('div > span .menu-item:contains("Home")').css('font-weight', 'bold'); | |
// Optimisation: Instead of using "div" as the start, we should use something more specific like #id or .cssClassName to avoid going over every DIV of the page | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* this is just to make the test page look a bit nicer */ | |
body { | |
margin: 1em; | |
} | |
.menu-item { | |
border: 1px solid blue; | |
padding: .5em; | |
} | |
a { | |
text-decoration: underline; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment