I am trying to replace the content of a div in a smarty template based on what link a user clicks on.
Problem: When I click on the link, the page to which the href points opens in the same window in the browser, instead of overwriting the content in just one part of the page.
--> For reference, this is the web page.
The following is my jQuery code:
$('#notes').click(function(evt)
{
$('#main').html(($this).attr('href'));
evt.preventDefault();
});
Updated jQuery code based on FYE's suggestion
$(document).ready(function(){
$('#notes').click(function(evt)
{
$('#main').append(get(($(this).attr('href'))));
evt.preventDefault();
});
});
It's in a script tag in the head of the template.
Source of hrefs:
{block name=sidebar}
<p class="nav-header" id="notes">Notes</p>
{foreach $lectures as $lecture}
<a href={$lecture} class="notes">{$lecture@key}</a><br>
{/foreach}
{/block}
Target:
{block name=body}
<div id="main">
Bob
</div>
{/block}