Now I want to be able to access the individual radio button id and whether it has been checked or not.
I would think JSON.stringify is needed as first step?
I had tried that earlier actually with a forEach loop, and this was returned:
[object HTMLCollection]
interactive-rating.js:20 value: [
interactive-rating.js:20 value: o
interactive-rating.js:20 value: b
interactive-rating.js:20 value: j
interactive-rating.js:20 value: e
interactive-rating.js:20 value: c
interactive-rating.js:20 value: t
interactive-rating.js:20 value:
etc.
I have tried this
function getString(obj){
[...obj].forEach(function(value,index){
return('value:',value);
});
}
container = JSON.stringify(container,getString(container));
function getString(obj){
[...obj].forEach(function(value,index){
return('value:',value);
});
}
function getClass(className){
return document.getElementsByClassName(className);
}
//'page' variable is returned by another function, but not relevant
window.addEventListener('click',function(){
if(page === 'index.html'){
let htmlArr = getClass('form-control');
htmlArr = JSON.stringify(htmlArr,getString(htmlArr));
sessionStorage.setItem("htmlArr", htmlArr);
}
});
I use sessionStorage.getItem(‘htmlArr’) for another page, and it returns: votesArr: {"0":{},"1":{},"2":{},"3":{},"4":{}}
I’m actually getting some errors now in github.
It works just fine on my laptop, I can select a button, click submit, and it will display the correct radio button number.
But on github I’m getting error messages?
Could this something in getPage() , the url is wrong or such?
Hi, I hope you can help. I think it’s a github issue, as my code works fine with no errors on my laptop ,just in github deployment it’s throwing this error (before any click/submit):
Error with Permissions-Policy header: Origin trial controlled feature not enabled: ‘interest-cohort’.
I did yes, I’m a bit stressed atm as I’m going on a overseas trip soon, so wanted this done asap to avoid the stress .
It does work though , I’m still learning, I will experiment with your code as well when I get back
I also mentioned your help in the readme.md file
Thanks!