WordPress.org

Ready to get started?Download WordPress

Forums

HREF tag within a plugin (4 posts)

  1. cultureclash
    Member
    Posted 1 year 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….

    ….else
    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
    Member
    Posted 1 year ago #

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

  3. cultureclash
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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

Tags

No tags yet.