Several errors.
For starters, when you clone your elements you are getting
Code:
<input type="text" name="user[]2"/><select name="type[]2" onchange="showHide(this)">
...
<input type="text" name="user[]3"/><select name="type[]3" onchange="showHide(this)">
...
If this page is intended to be submitted to a PHP page, then those names should either be just *ALL* "user[]" or they should be "user[2]", and so on.
Also, *ALL* your <div>s are getting the *SAME* id!!!! <div id="divselect">
That is *ILLEGAL* HTML! You will no longer be able to use document.getElementById("divselect") because of the illegality.
Also, you have this code:
Code:
//hide the divs
for(var i=0; i < divsO.length; i++) {
divsO[i].style.display = 'block';
}
Your comment says "hide the divs", but then your code SHOWS them all.
And I think you have goofed in another way: I think you have forgotten that you have *TWO TYPES* of <div>s!!
Code:
<div id="add_user" style="display: none;">
...
<div id="add_user" style="display: none;">...</div>
</div>
and *BOTH TYPES* are included in your
divsO variable!!!
In short, this is pretty much a complete hash and you need to almost start over and think about what you are after.