samedi 18 avril 2015

How to make a variable which is inside a function global?


Vote count:

0




Following is my javascript function, I want to use variable selected outside function, but I am getting selected not defined error in console of inspect element.



function showMe(pause_btn) {
var selected = [];
for (var i = 0; i < chboxs.length; i++) {
if (chboxs[i].checked) {
selected.push(chboxs[i].value);
}
}
}


asked 35 secs ago







How to make a variable which is inside a function global?

Aucun commentaire:

Enregistrer un commentaire