Support » How-To and Troubleshooting » HREF tag within a plugin

HREF tag within a plugin

  • Hey together!
    I have a problem and after hours of trying I’m not able to find a solution for it. 
I have to implement a link in the output of a wordpress plugin which scrolls the whole page to the top.
    Therefore I have written a jQuery function called “scrolling”. It’s in a script.js file in my template folder.
    If I put the HREF Tag (<a href="#" id="scrolling">Scroll up</a>) into a wordpress post, everything works fine as it should. The page scrolls up.
 But if I try to use it in the plugin directly….

    return '<a href="#" id="scrolling">Scroll up</a>' ;}

    …. it doesn’t work. The link is at the right place on the blog, but the jQuery function isn’t called up. Why that? Is the id not passed to the script?! Maybe you can give me a hint. 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • Is the javascript that contains your scroll up function being included on the page?

    Yes it is. Even the source code in the browser is outputted correctly.
    That’s the output of the code from the wordpress post (that works)
    <a href="#" id="scrolling">Scroll up</a></p>
    And only one line below exactly the same code outputted by the plugin:
    <span style=”color: red;”>To see this content you have to be logged in!</span>
    <a href="#" id="scrolling">Scroll up</a> (that doesn’t work)

    Any further suggestions?! I need a fix for that :/

    Can you post a link to the page so I can take a look please?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘HREF tag within a plugin’ is closed to new replies.