Loading ...
Sorry, an error occurred while loading the content.
 

Re: Span or Div

Expand Messages
  • Jon Stephens
    ... Use the element s tagName property: alert( document.getElementById( someElement ).tagName ); -- This message has not been scanned for viruses. Since I do
    Message 1 of 4 , Jun 1, 2006
      > Date: Wed May 31, 2006 12:00 am (PDT)
      > From: "kmcoleoz" ken.m.cole@...
      > Subject: Span or Div
      >
      >
      > If I have the id of an element and therefore can get to it
      > by "getElementById()", once I have it, how can I tell if it is a span
      > or a div? In my case I know it will be one or the other?
      >
      > Thanks
      >
      > Ken

      Use the element's tagName property:

      alert( document.getElementById('someElement').tagName );



      --
      This message has not been scanned for viruses.

      Since I do not use a Microsoft operating
      system or software, and use only plaintext
      for email, there is little need for me to do so.
    Your message has been successfully submitted and would be delivered to recipients shortly.