HREF tag within a plugin (4 posts)

  1. cultureclash
    Posted 2 years ago #

    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. :)

  2. Andrew Bartel
    Posted 2 years ago #

    Is the javascript that contains your scroll up function being included on the page?

  3. cultureclash
    Posted 2 years ago #

    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 :/

  4. Andrew Bartel
    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.