Skip to content

Instantly share code, notes, and snippets.

@jonahlyn
Created November 1, 2012 20:38
Show Gist options
  • Save jonahlyn/3996350 to your computer and use it in GitHub Desktop.
Save jonahlyn/3996350 to your computer and use it in GitHub Desktop.
Append a new tag to something using jquery
<script>
$(function(){
var today = new Date(),
expiration = new Date('2012-12-31');
if( today <= expiration ){
var newicon = $('<span class="new"> new!</span>');
newicon.css({
'color': 'gold',
'padding-left':'5px',
'float':'right',
'-webkit-transform':'rotate(20deg)',
'-moz-transform':'rotate(20deg)',
'-ms-transform':'rotate(20deg)',
'-o-transform':'rotate(20deg)',
'transform':'rotate(20deg)',
'-webkit-transform-origin':'bottom right',
'-moz-transform-origin':'bottom right',
'-ms-transform-origin':'bottom right',
'-o-transform-origin':'bottom right',
'transform-origin':'bottom right',
'text-shadow':'1px 1px 1px #1F1E1E'
});
$('li:contains("Maps") a','#searchnav').append(newicon);
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment