Why do I see MS jQuery samples use `$(domReady); `?
- by Atomiton
I don't know if anyone ELSE has noticed this, but I noticed the jQuery samples I see on MS tend to use a different format:
<script type="text/javascript">
$( domReady );
function domReady() {
$('#btn').click( showMessage );
}
function showMessage() {
$('#message').fadeIn('slow');
}
</script>
Isn't this the same as:
$(document).ready( function() {
$('#btn').click( showMessage );
function showMessage() {
$('#message').fadeIn('slow');
}
});
Is there any advantage of using one syntax over the other?
I will admit, the MS way does look cleaner.