Skip to content

Instantly share code, notes, and snippets.

@spencermathews
Created January 22, 2016 01:08
Show Gist options
  • Save spencermathews/c4588993060475d2a6e8 to your computer and use it in GitHub Desktop.
Save spencermathews/c4588993060475d2a6e8 to your computer and use it in GitHub Desktop.
2-jQuery change content
<section>
<nav>
<ul>
<li></li>
<li id="second"></li>
<li></li>
</ul>
</nav>
</section>
$(document).ready(function() {
//console.log("ready");
//change a css property
$('body').css('background-color', '#65B6D6');
//add text through js to the first li by targeting it with the pseudo class first-child
/*add html text to the second li by targeting its id. include <strong> around one word to see the css in action*/
});
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
* {
margin:0px;
padding:0px;
}
body {
background-color:white;
}
section{
width:4in;
margin:2in auto 0 auto;
}
ul {
box-shadow:5px 5px 5px #444;
border-radius:20px;
}
li {
list-style-type:none;
height:1in;
background-color:#333;
border-bottom:#CCC 1px solid;
}
li:first-child {
border-top-left-radius:20px;
border-top-right-radius:20px;
}
li:last-child {
border-bottom-left-radius:20px;
border-bottom-right-radius:20px;
border-bottom:none;
}
strong {
color:orange;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment