Skip to content

Instantly share code, notes, and snippets.

@tabebqena
Last active May 30, 2018 09:15
Show Gist options
  • Select an option

  • Save tabebqena/7cb44dc300a028517addcb6201abe86b to your computer and use it in GitHub Desktop.

Select an option

Save tabebqena/7cb44dc300a028517addcb6201abe86b to your computer and use it in GitHub Desktop.
function getInput(id){
try{
console.info("function: getInput.\nArguments: "+id)
return document.getElementById(id).value;
}
catch(err) {
console.error(err.name , err.message);
}
}
function getInputs(cl){
try{
console.info("function: getinputs.\nArguments: "+cl)
var array = [];
var x = document.getElementsByClassName(cl);
for (var i = 0 ; i<x.length ; i++ ){
array.push(x[i].value)
}
return array
}
catch(err) {
console.error(err.name , err.message);
}
}
function setInput(id, val){
try{
console.info("function setInput\n", id , val)
document.getElementById(id).value = val;
}catch(err){
console.error(err.name, err.message)
}
}
function isChecked(id){
try{
console.info("ischecked", id)
var x = document.getElementById(id).checked
console.log(x)
return x
}catch(err){
console.error(err.name, err.message)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment