I am creating a public site and I use a lot of jQuery and jQueryUI. I noticed that most sites on the Internet using jQuery and jQueryUI do not have this code on their pages.
<script type="text/javascript">
$(document).ready(function(){
$("a").click(function(event){
alert("Thanks for visiting!");
});
$( "input:submit" ).button();
});
</script>
I know this is a simplified example, but most sites, like SO, contain only one obfuscated js file for all pages. It doesn't even look like they are using $ (document) .ready anywhere. On my current site, it seems that I will need to add a js file for each page. My question is how should this be done, and is there any best practice to use / enable javascript on the page?
source
share