Created
May 1, 2010 17:20
-
-
Save artlung/386498 to your computer and use it in GitHub Desktop.
A simple hello world jQuery example
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
<html> | |
<head> | |
<title>My Sample</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
var new_num = 40; // global variable | |
jQuery(document).ready(function(){ | |
http://api.jquery.com/css/ | |
$('p').css({border: '5px solid red', color: 'green', padding: '20px'}); | |
// http://api.jquery.com/bind/ | |
// http://api.jquery.com/css/ | |
// http://api.jquery.com/text/ | |
$('#countme').css({ | |
margin: '0 auto', | |
backgroundColor: '#ccc', | |
textAlign: 'center', | |
fontSize: '40px' | |
}).bind('click mousemove', function(){ | |
var current = parseInt($(this).text(), 10); | |
new_num = new_num + 1 | |
$(this).text(current+1).css({fontSize: new_num+'px'}) | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<p>Hello</p> | |
<p>World</p> | |
<div id="countme">0</div> | |
<a href="http://api.jquery.com/">Learn more about jQuery's methods</a> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment