Find and HTML Element

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If I have an HTML element, say a <p> tag with and ID="Fred", how do I find
that element? I want to set the Style attribute to "hidden", how do I do
that?

Thanks!!!
 
If I have an HTML element said:
that element? I want to set the Style attribute to "hidden", how do I do
that?

If this is to toggle items on/off on screen, then this is probably a job for
javascript.

If it's to toggle items on/off via a postback, then I'd just use
labels/placeholders to hold the content and set those visbible states in the
codebehind.

Otherwise, you can put a runat="server" in the P tag and access it that way.

-Darrel
 
I am using javascript to turn on and off an error message based on an edit
which is imposed in the javascript. But when the page comes back to the
server I am going to run the test again at the server and hence I want to
turn the message on if I detect and error.

OK, I place a "runat="server" and then access, but I'm still not sure what
the code would look like to change the visibility property and I am not sure
which class I should use for the <P> element. Is this equate to the
"HtmlContainerControl"? That has no "Attibutes" property. Maybe I should
use the plain "HtmlControl"?
 
Back
Top