Hi can someone assist me with altering this coding I’m trying to remove the href page#.html loading and use a preloaded li with the text to populate the sclit div when a link is clicked.
<div id="sclit"></div>
<!-- old code
<a href="page1.html" class="para">Sci Lit 1</a>
<a href="page2.html" class="para">Sci Lit 2</a>
<a href="page3.html" class="para">Sci Lit 3</a>
-->
<ul style="display:none">
<li class="page1"> text text </li>
<li class="page2"> text text </li>
<li class="page3"> text text </li>
</ul>
<script>
jQuery(document).ready(function() {
jQuery(".para").click(function() {
// jQuery("#sclit").load(jQuery(this).attr('href')); // old code
jQuery("#sclit").load(jQuery(this).attr('li'));
});
});
</script>
I think you’re just trying to eliminate the
.loadin which case you could do something like this:http://jsfiddle.net/GgMee/
Change the html markup to this:
Where the
detailsdiv after each link is hidden and contains the text you want to display when that link is clicked.Then the jquery is this:
Clicking on a link, finds the
detailsdiv after it and puts the text from it into thesclitdiv.