[Logo]
Forums Register Login
accessing data in without ambiguity between same element.
Hello all, i m using 1 dropdown and a textarea to display the data i recieved from database using ajax.


MY AJAX CODE TO INSERT IN ELEMENT ----

document.getElementById("add_detail").innerHTML =response;

document.getElementById("complete_detail").innerHTML =response1;


MY HTML CODE ----------

<div name ="add_detail" id="add_detail">
<select name="add_detaila" id="second_drpdwn" onchange="GetSelectedItem2(this)" >
<option>Select City</option>
</div>


<div id="complete_detail" name="asd">
<textarea id="asd" name="comp_det" rows="30" cols="70" >
</textarea>
</div>



But the above code is not working, onselecting valueu from the dropdown textarea is disapeearing.

However If I add a dropdown list of the same id or a diff id proper result are being displayed.
My Edited code is -


HTML COde----

<div name ="add_detail" id="add_detail">
<select name="add_detaila" id="second_drpdwn" onchange="GetSelectedItem2(this)" >
<option>Select City</option>
</div>

<div name ="add_detail" id="add_detail">
<select name="add_detaila" id="second_drpdwn" onchange="GetSelectedItem2()" >
<option>Select City</option>
</div>


<div id="complete_detail" name="complete_detail">
<textarea id="asd" name="comp_det" rows="30" cols="70" >
</textarea>
</div>




Can anyone tell me hows that possible. Because the name and id of both the dropdown here are same. NOw th text area is showing proper result.
ids are singular, you can only have one per page.

Eric
Also, divs don't have names.
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Nov 21, 2017 22:54:57.