I want to save the same object type in an Array()
For example when I want to select all checkboxes and save the value in an Array:
selectAllCbs: function() {
var self = this;
$('#' + instanceName + 'table_form input[type=checkbox]').each(function(index,cb) {
if($(cb).prop('disabled') == false) {
$(cb).prop('checked',true);
console.log("Select all clicked:" + cb); //gives me [object HTMLInputElement] result
selected.push(cb); //save to an array
self.changeRowStyle(cb);
}
});
When I use almost the same code when user clicks on the row I'm getting different type:
rowClicked: function(id) {
var cb = $('#' + instanceName + 'cb_' + id);
if($(cb).is(':checked')) {
$(cb).prop('checked',false);
selected.splice(selected.indexOf(this.value),1);
} else {
$(cb).prop('checked',true);
console.log("Row clicked:" + cb); //gives me [object Object]
selected.push(cb);
}
this.changeRowStyle(cb);
},
So the main question is how to save the rowClicked element in the [object HTMLInputElement] type?
Because in the first example I can read values with selected[i].value and with the second one I need to read it with the selected[i][0].value.
"Select all clicked:" + cb...really !?...select allor in therow clicked?var cb = $('#' + instanceName + 'cb_' + id);cb is a jquery object, a DOM element wrapped with jquery functions