1

I've got scrollspy working just perfectly, however it skips the items that contain a plus-sign (+) in their id's, affixes aswell. Is there any workaround here except for trimming the id's? I prefer the + signs in the id for SEO reasons and the id's are dynamically generated and reused in other code so I prefer to keep them this way.

<nav id="sidebarnav">
    <ul class="nav">
        <li class="active"><a href="#works">works</a></li> 
        <li><a href="#skip+it">Skip it</a></li> <!-- thisone it will skip -->
        <li class=""><a href="#also">also</a></li> 
        <li class=""><a href="#this">this</a></li>
    </ul>
</nav>
Dani
  • 2,448
  • 8
  • 27
  • 44
  • Your example code don't have plus sign? Or i do not understand your question – Bass Jobsen Sep 10 '13 at 21:39
  • You are right, in this example I inserted a hyphen, which was my second step to check if that would work. But that doesn't work either. I'll edit it. Thanks – Dani Sep 11 '13 at 10:18

1 Answers1

1

plus signs are not allowed in id values, see: What characters are allowed in DOM IDs?. Why should using plus signs help your SEO? Maybe also read: URL encoding the space character: + or %20?.

Consider to replace the + with a _

Community
  • 1
  • 1
Bass Jobsen
  • 48,736
  • 16
  • 143
  • 224
  • Plus signs would help my SEO compared to trimming the id's for example. They are being re-used in my back-end code several times so I prefer them to stay the same. I was aware of the non-compliance of the id's, but that's why I used a hyphen in my example to show that that doesn't work either. Anyways, I think I should re-arrange my golang back-end that automatically inserts the +-symbols into an HTML template using "urlquery". Thanks a lot for your help though! – Dani Sep 11 '13 at 10:48