Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #19437

Re: javascript to test if anchor tag is contained within div tag

From Martin Leese <please@see.Web.for.e-mail.INVALID>
Newsgroups comp.lang.javascript
Subject Re: javascript to test if anchor tag is contained within div tag
Date 2013-04-24 12:42 -0600
Organization A noiseless patient Spider
Message-ID <kl98s8$k08$1@dont-email.me> (permalink)
References <3191a789-89f0-4740-b9cc-77719dac2f60@googlegroups.com> <513f882b-c8a4-4c55-a475-e54a9f0d7ae8@googlegroups.com>

Show all headers | View raw


CharlesEF wrote:
> Hi All.
> 
> I case someone else needs answer, here is the solution I came up with.  Here is the updated HTML code (per W3.org guidelines):
> 
> <ul>
>  <li><a href="" target="main" onclick="">Item1</a></li>
>  <li id="1"><a href="javascript:toggleUl('sony');">Item2</a>
>   <ul id="sony" class="hide">
>    <li id="1.1"><a href="" target="main" onclick="">Item2-Sub1</a></li>
>    <li id="1.2"><a href="" target="main" onclick="">Item2-Sub2</a></li>
>    <li id="1.3"><a href="" target="main" onclick="">Item2-Sub3</a></li>
>   </ul>
>  </li>
>  <li><a href="" target="main" onclick="">Item3</a></li>
> </ul>

Note that these id's are invalid in HTML 4.01.
The standard states:
    "ID and NAME tokens must begin with a
     letter ([A-Za-z]) and may be followed by
     any number of letters, digits ([0-9]),
     hyphens ("-"), underscores ("_"),
     colons (":"), and periods (".")."

In HTML 5:
    "The id global attribute is now allowed
     to have any value, as long as it is
     unique, is not the empty string, and
     does not contain space characters."

So, make sure you are using the appropriate
doctype.

-- 
Regards,
Martin Leese
E-mail: please@see.Web.for.e-mail.INVALID
Web: http://members.tripod.com/martin_leese/

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

javascript to test if anchor tag is contained within div tag charles.e.finkenbiner@gmail.com - 2013-04-22 08:15 -0700
  Re: javascript to test if anchor tag is contained within div tag Danny <dann90038@gmail.com> - 2013-04-22 13:18 -0700
  Re: javascript to test if anchor tag is contained within div tag Danny <dann90038@gmail.com> - 2013-04-22 13:22 -0700
    Re: javascript to test if anchor tag is contained within div tag charles.e.finkenbiner@gmail.com - 2013-04-22 17:34 -0700
      Re: javascript to test if anchor tag is contained within div tag charles.e.finkenbiner@gmail.com - 2013-04-22 20:31 -0700
        Re: javascript to test if anchor tag is contained within div tag Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-23 10:07 +0200
  Re: javascript to test if anchor tag is contained within div tag Danny <dann90038@gmail.com> - 2013-04-23 11:50 -0700
  Re: javascript to test if anchor tag is contained within div tag CharlesEF <charles.e.finkenbiner@gmail.com> - 2013-04-24 01:51 -0700
    Re: javascript to test if anchor tag is contained within div tag Martin Leese <please@see.Web.for.e-mail.INVALID> - 2013-04-24 12:42 -0600
      Re: javascript to test if anchor tag is contained within div tag CharlesEF <charles.e.finkenbiner@gmail.com> - 2013-04-24 14:40 -0700

csiph-web