Here is the code snippet from my HTML file:
<html>
<head>
<link rel="stylesheet"
href="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">
<link rel="stylesheet"
href="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap-theme.min.css">
<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
<title>CodeConfig</title>
<style>
.btn-primary-spacing
{
margin-right: 10px;
margin-bottom: 5px !important;
}
body {
padding: 10px;
}
.dropdown:hover .dropdown-menu {
display: block;
margin-top: 0; // remove the gap so it doesn't close
}
</style>
</head>
<body>
<div class="container">
<h2>CodeConfig Keys</h2>
<br>
<div id="key-buttons">
</div>
</div>
<script type="text/javascript">
function linkClickFunc(item,key)
{
console.log("trying");
console.log(item + key);
}
</script>
<script>
$(document).ready(function(){
CodeConfigkeys = {"ENV": ["Subhayan", "Mary"], "DB_PARAMS": ["SQL_CONNECTIONS_DB", "SQL_CONNECTIONS_COLLECTION"]};
var html_str = "";
$.each( CodeConfigkeys, function( key, value ){
html_str = html_str + "<div class=\"btn-group dropdown\">";
html_str = html_str + "<button type=\"button\" class=\"btn btn-primary dropdown-toggle btn-primary-spacing\" data-toggle=\"dropdown\" id=\"" + "CodeConfigMenus" + "\">" + key;
html_str = html_str + "</span><span class=\"sr-only\">Toggle Dropdown</span></button>";
html_str = html_str + "<div class=\"dropdown-menu\">";
submenus = value;
console.log(submenus);
value.forEach(function(item, index, array) {
html_str = html_str + "<li><a href=\"javascript:linkClickFunc('" + item + "','" + key + "');\">" + item + "</a></li>";
});
html_str = html_str + "</div></div>";
});
$("#key-buttons").html(html_str);
});
Upon clicking a link in the dropdown menu, I encounter a syntax error - "unexpected end of input."
I suspect that there may be some missing brackets or punctuation mistakes.
If anyone can pinpoint where I'm going astray, I would greatly appreciate it.
Thank you in advance.