I have an object and want to add the details of that to the content of JQUERY-CONFIRM.
This is my code:
const obj = {
'alphabets':['abc', 'xyz', 'pqr'],
'colors':['red', 'blue', 'purple']
}
$.dialog({
title: 'Test',
columnClass: 'col-md-6 col-md-offset-6',
content: function() {
for (let key in obj) {
return `<h3 class='float-left'>${key}</h3>
<ul class='float-left'>
<li class='float-left'>${obj[key]}</li>
</ul>
`;
}
},
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.4/jquery-confirm.min.js"></script>
Why am I only getting the first key-value in my content and also why aren't they listing out in the list but showing up as comma-separated values?