I have no idea whether this should be done or not.
Here is my problem:
I created an function which creates and stores 10 div elemets(with unique IDs).
I want to make another function which would take an array as its parameter and alert the ID of the 5th div(or any particular div element).
Please help
function createText(){
var combo = [];
for( i =0; i<=5 ; i++) {
var newText = document.createElement("input");
newText.type = "text";
newText.id = "text"+i;
newText.style.width ="20px";
newText.style.height ="20px";
var newDiv = document.createElement("div");
newDiv.type = "div";
newDiv.id = "div"+i;
newDiv.style.backgroundColor ="red";
newDiv.style.cssFloat = "left";
document.getElementById("tryingin").appendChild(newDiv.cloneNode());
combo.push(document.getElementById("div"+i).appendChild(newText.cloneNode()));
}
alert(combo);
}
function alert(arr) {
//now I want to alert the id of the div(or textbox) here
}
array.slice(...)function