JS error:identifier starts immediately after numeric literal

3 replies
identifier starts immediately after numeric literal:
Trying to correct this:
Code:
<a onclick="body.div.class.layout-item-1.style.display='none'" href="#"
 rel="nofollow" target="_top">remove image</a>
#erroridentifier #immediately #literal #numeric #starts
  • Profile picture of the author Brandon Tanner
    Your post isn't very clear. Are you trying to hide a div with the ID of "layout-item-1", when <a> is clicked?

    If so, then...

    Code:
    <a onclick="document.getElementById('layout-item-1').style.display='none'" href="#"
     rel="nofollow" target="_top">remove image</a>
    Signature

    {{ DiscussionBoard.errors[8893653].message }}
    • Profile picture of the author rhinocl
      Yes you guessed correctly.That worked once I added the id to the div (There was only a class name).
      {{ DiscussionBoard.errors[8893726].message }}
      • Profile picture of the author Brandon Tanner
        Yeah... selecting an element by ID is the easiest way to do it, as there is no simple, reliable (cross-browser) way to select elements by class in traditional Javascript (although it's a cinch with jQuery).
        Signature

        {{ DiscussionBoard.errors[8893906].message }}

Trending Topics