I am trying to get the below script to run but I can’t, any suggestions?
The point is I am trying to call external content from other pages. When i write it individually it is okay, but when I tried to load it from a list or by click, it doesn’t work as expected
<div id="test">
<a href="1/1.html">text 1</a>
<a href="1/2.html">text 1</a>
</div>
<b>see the text:</b>
<ol id="new-nav"></ol>
<script>
$("#test").click(function () {
$("#new-nav").load("href");
});
</script>
Instead of passing "href" to loadwhich is not a valid resourcepass the href of link being clicked, I also changed the selector to bind click with anchor. Putting in $(document).ready will ensure the availabilty of dom Element before use, It safe to use it.