First, you must put your Javascript code outside the element itself. This is pretty easy to do. This makes your HTML and Javascript much more understandable and, ultimately, allows much more organized code. First give your element a a id :
<a href='#' id='loadPage'>Link</a>
Then make your call with a script tag:
<script type="text/javascript"> $(document).ready(function() { </script>
Change To comment, yes, you can use the url in the a tag and then use this.href .
<a href='page.html' id='loadPage'>Link</a> <script type="text/javascript"> $(document).ready(function() { $('#loadPage').click(function(e){ e.preventDefault(); $('#target') .hide() .load(this.href, function() { $(this).fadeIn(1000); }); }); }); </script>
source share