I have this javascript that retrieves a list of values from a html form, but I need a button click event to display this output as a custom window with the retrieved (not alert) list of values selected on the form on separate lines
function printChecked(){
var items=document.querySelectorAll('[name="option"], [name="selectedfeaturem"], [name="selectedfeaturep"], [name="selectedsoftware"], [name="selectedfeature"]');
var selectedItems="";
for(var i=0; i<items.length; i++){
if(items[i].checked==true)
selectedItems+=items[i].value+"\n";
}
return selectedItems;
}
It works in a div within the form but I need it as a custom Popup window (could be css formatted) but it fails when I attempt to add it to these div. This div works on the form as a standalone code but I need to combine both set of codes so that on click the below tab will display the above list within the pop-up window.
<p>This is the main content to display <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">here</a></p>
<div id="light" class="white_content">This is the lightbox content. <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">Close</a></div>
<div id="fade" class="black_overlay"></div>