Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes HTML, CSS and JavaScript and the fly likes accessing data in without ambiguity between same element. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "accessing data in without ambiguity between same element. " Watch "accessing data in without ambiguity between same element. " New topic
Author

accessing data in without ambiguity between same element.

chetan sisodiya
Greenhorn

Joined: Nov 14, 2011
Posts: 12
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.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15385
    
    6
ids are singular, you can only have one per page.

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63208
    
  69

Also, divs don't have names.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: accessing data in without ambiguity between same element.
 
It's not a secret anymore!