Uncaught syntaxerror: Unexpected token

Source: Internet
Author: User
<  Ul  >                      <  Li  > <  A  Href  = "Javascript: void ();"  > Title1 </  A  > </  Li  >                      <  Li > <  A  Href  = "Javascript: void ();"  > Title2 </  A  >   </  Li  >                      <  Li  > <  A  Href  = "Javascript: void ();" > Title4 </  A  >   </  Li  >                      <  Li  > <  A  Href  = "Javascript: void ();"  > Title3 </  A  >  </  Li  >                  </  Ul  > 

When debugging with chrome, the following error occurs: uncaught syntaxerror: Unexpected token <,

After the Li Bing Click Event, write javascript: void () to href to control the <A> link operation ();

In this case, errors are always reported from time to time ..

That's strange ..

It is reported when jquery is tracked ..

Although this error does not affect the function, it does not affect the performance ..

 

The root cause is that javascript: void (); is written in <A>.

If you click Li, no error is reported. Click <A>.

Because the sequence of jquery implementation is from inner to outer.

SetCodeChange

 < Ul  >                      <  Li  > <  A  Href  = "Javascript :;"  > Title1 </  A  > </  Li  >                      <  Li  > < A  Href  = "Javascript :;"  > Title2 </  A  >   </  Li  >                      <  Li  > <  A  Href  = "Javascript :;"  > Title4</  A  >   </  Li  >                      <  Li  > <  A  Href  = "Javascript :;"  > Title3 </  A  >   </ Li  >                  </  Ul  > 

This error disappears.

There are many reasons for this error, but this is only one of them.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.