Created
August 1, 2013 07:59
-
-
Save kad1r/6129348 to your computer and use it in GitHub Desktop.
Get input hidden types and checkboxes ...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hiddenByName() { | |
// consider you have a div or table which name is dvHiddenValues | |
// consider you have a hidden inputs which name is myHdValues | |
var arrList = new Array(); | |
// that gives you the list of hidden inputs which name is myHdValues | |
var hiddenList = document.getElementById('dvHiddenValues').document.getElementsByName('myHdValues'); | |
for (var i = 0; i < hiddenList.length; i++) { | |
arrList.push(hiddenList[i].value); | |
} | |
} | |
// this function gives you the checkbox list that you checked | |
function findCheckboxes() { | |
var checkedList = new Array(); | |
// consider you have a div or table which name is dvMyDiv | |
var inputs = document.getElementById('dvMyDiv').document.getElementsByTagName("input"); | |
for (var i = 0; i < inputs.length; i++) { | |
if (inputs[i].type == 'checkbox') { | |
if (inputs[i].checked) { | |
checkedList.push(inputs[i].value); | |
} | |
} | |
} | |
} | |
// this function gives you the checkbox list which has spesific id that you checked | |
function findCheckboxes() { | |
var checkedList = new Array(); | |
// consider you have a div or table which name is dvMyDiv | |
var inputs = document.getElementById('dvMyDiv').document.getElementsByTagName("input"); | |
for (var i = 0; i < inputs.length; i++) { | |
// consider checkbox id's stars with chkbx, ex: <input type="checkbox" id="chkbx_1" value="5" /> | |
if (inputs[i].type == 'checkbox' && inputs[i].id.indexOf('chkbx') == 0) { | |
if (inputs[i].checked) { | |
checkedList.push(inputs[i].value); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment