Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Using "visibility" style attribute with select elements

Reply
Thread Tools

Using "visibility" style attribute with select elements

 
 
Dave Hammond
Guest
Posts: n/a
 
      02-18-2005
I'm not sure if this is technically a javascript question, but I'm
coding in javascript, so I'll try here first.

To overlay a section of a page I typically use an absolute positioned
<div> and call insertAdjacentHTML. By raising the z-index higher than
than the underlying elements this method works fine, except if there is
a window'd element below it, such as a <select>. My understanding is
that I need to use the visbility attribute to hide the <select> before
calling insertAdjacentHTML.

Each <select> element (there are three) is identified with the ID
"select_vis". I am attempting to hide the select elements using the
following code:

selvis = document.getElementById('select_vis');
if (selvis) {
alert('gonna hide the selects.');
selvis.style.visibility = 'hidden';
}
document.body.insertAdjacentHTML('BeforeEnd', theHTML);

The code is being executed, however the three selects stay visible. Any
suggestions/observations would be greatly appreciated.

Thanks,
Dave H.

 
Reply With Quote
 
 
 
 
Dave Hammond
Guest
Posts: n/a
 
      02-18-2005
After a bit closer examination, I found that the first select was
hidden, but all others remained visible. I changed the code so that
all selects have individual IDs and now everything hides as expected.

Thanks.
-Dave H.

 
Reply With Quote
 
 
 
 
Michael Winter
Guest
Posts: n/a
 
      02-18-2005
Dave Hammond wrote:

> After a bit closer examination, I found that the first select was
> hidden, but all others remained visible.


That's the expected behaviour.

> I changed the code so that all selects have individual IDs [...]


Good. Every id in a document /must/ be unique. You would have found
that had you validated the mark-up.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
When do elements get their style attribute values? Tim Streater Javascript 24 07-18-2011 05:30 AM
When do elements get their style attribute values? Tim Streater HTML 2 07-11-2011 04:29 PM
[XSLT] Select node by attribute with value from an attribute of its self Stefan_W XML 1 11-05-2008 10:50 AM
Control of CSS pseudo elements through a STYLE attribute in .NET framework Kevin Frey ASP .Net 0 07-28-2006 07:17 AM
picking value of one attribute based on a child elements attribute? XPath? vjethava@gmail.com XML 2 03-06-2006 05:19 AM



Advertisments