$('#message1').show('medium');
$('#message1').addClass('alert');
jQuery at work
$('#message2').fadeIn('slow').addClass('alert').html('Validate your markup!');
(text goes here)
We can use the ready() function to find out
$(document).ready(function() {
// start coding
});
$('#control').click(function() {
$('#message').show().addClass('alert');
});
$('#control').toggle(function() {
$('#message').show().addClass('alert');
}, function(){
$('#message').removeClass('alert').hide();
});
var foo = jQuery.noConflict();
foo('#message').show();
$('#control').click(function() {
$('#message').load('current.php');
});
$('#demo3-1 li').click(function() {
$city = $.trim($(this).text());
$('#city-container p').html('Loading...').load('cities.php', { city: $city });
});
$content = array(
'Washington DC' => 'Washington, D.C. is the capital...'
...
);
if (isset($_REQUEST['city'])) {
$city = $_REQUEST['city'];
if (in_array($city, array_keys($content))) {
echo $content[$city];
}
}
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- generator="FeedCreator 1.7.2" -->
<rss version="2.0">
<channel>
<title>Joe LeBlanc's Blog</title>
<description>Joe's personal weblog</description>
<link>http://www.sidewalkadvocate.com</link>
<lastBuildDate>Tue, 09 Oct 2007 19:34:03 +0100</lastBuildDate>
<generator>FeedCreator 1.7.2</generator>
<item>
<title>Designed by Apple in California</title>
<link>http://www.sidewalkadvocate.com/content/view/218/6/</link>
<description>Joel reflects (http://www.joelonsoftware.com/items/2007/10/05.html) on some of Apple's subtle marketing and Microsoft's lame attempt at copying it. </description>
<category>Writings - Miscellaneous</category>
<pubDate>Mon, 08 Oct 2007 10:25:19 +0100</pubDate>
</item>
<item>
<title>While programming today...</title>
...
$('#demo5-1').click(function() {
$('#headline-container').html('');
$.get('headlines.xml', function(rss){
$(rss).find('item title').each(function(index) {
$('#headline-container').append('<p>' + $(this).text() + '</p>');
});
});
});
← →
jQuery - an introduction
Joseph L. LeBlanc