Jquery .append list not working
Hello Guys,
I have an issue with my jquery and I cant seem to figure it out
So I have a home.jsp file and I have two include statements
I'm including quicklinks,jsp and activity.jsp
In my quicklinks.jsp file i have the following and it displays a list as it should
- <div class="headertxt">Quick Links</div>
<hr>
<script>
var options = [
{ "href": "something1.jsp",
"text": "My linktext1" },
{ "href": "something1.jsp", "text": "My linktext12" },
{ "href": "something3.jsp", "text": "My linktext13" },
{ "href": "something4jsp", "text": "My linktext14" }
];
$(document).ready(function() {
$.each(options, function(index) {
$("#myList").append($('<li> <i class="fa fa-link" aria-hidden="true"></i>').append($(" <a>", { href: options[index].href, text : options[index].text})));
});
});
</script>
<ul id="myList"></ul>
When I add this to my activity.jsp file it doesn't display a list at all. I also don't receive any errors
- <div class="headertxt">Activity</div>
<hr>
<script>
var aoptions = [
{ "href": "l2something1.jsp", "text": "My other linktext1" },
{ "href": "l2something2.jsp", "text": "My other linktext2" },
{ "href": "l2something3jsp", "text": "My other linktext3" },
{ "href": "l2something4.jsp", "text": "My other linktext4" },
{ "href": "l2something5.jsp", "text": "My other linktext5" }
];
$.each(aoptions, function(index) {
$("#activityList").append($('<li> <i class="fa fa-link" aria-hidden="true"></i>').append($(" <a>", { href: aoptions[index].href, text : aoptions[index].text})));
console.log("Testing");
});
</script>
<ul id="#activityList"></ul>
Any ideas why the activity list wont show?