Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing input tag with a dynamic id 1

Status
Not open for further replies.

Arzo2000

Programmer
Jul 7, 2005
12
CA
Here is what I have:
Code:
<div id="div" onmouseover="">
   <textarea name="textarea" id="txtNotes05" runat="server"></textarea>
   <input type="button" id="btnDeleteNote05" runat="server" 
   style="display:none;" />
</div>


What I would like to do is display the button as I hover over the div but I cannot access either the div or the button by their IDs because they are generated dynamically. Any ideas?

Thanks in advance guys.
 
Code:
<script type="text/javascript">

function showButton(obj) {
   var btn = obj.getElementsByTagName("input")[0];
   btn.style.display = "inline";
   //or you could set the display to "none" if you want to hide it
}

</script>

<div id="div" onmouseover="showButton(this)">
   <textarea name="textarea" id="txtNotes05" runat="server"></textarea>
   <input type="button" id="btnDeleteNote05" runat="server"
   style="display:none;" />
</div>

-kaht

Looking for a puppy?

silky-icon-left.gif
[small]Silky Terriers are small, relatively odorless dogs that shed no fur and make great indoor pets.[/small]
silky-icon-right.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top