Want to create a JavaScript array, after click event.
This is my function:
$(function() {
$('#tree,#tree-combined').on('acitree', function(event, api, item, eventName, options) {
if (api.isItem(item)) {
var itemSelect= [];
itemSelect.push(api.getId(item));
var itemEvent= eventName;
if (event) {
if (itemEvent=="checked") {
var a = api.getId(item);
eval('var arrayTmp = ' + a);
document.getElementById("Name").value = arrayTmp;
}
}
} else {
var itemEvent1= eventName;
}
});
});
And I want to use this array as hidden input field
<input type="hidden" id="Name[]" name="Name[]" />