Thursday, February 18, 2010

Programmer - jQuery Custom div loading not working.

Programmer Question

To those jQuery experts out there. I have the following markup and code:



<html>
<head>
<title>Test Framework</title>
<script src="js/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.nav').click(function(e) {
e.PreventDefault();
var id = $(this).attr('id');
var path = "views/" + id + ".html";
$("main").load(path);
});
});
</script>
</head>
<body>
<div id="links">
<a class="nav" id="test" href="javascript:void(0);">Test Page</a>
</div>
<div id="main">

</div>
</body>
</html>


...My nav class fires when I click the link, but fails to get past the PreventDefault method. Any ideas why this wouldn't be working?

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails