Prevent page from jumping to the top when seach is clicked

WordPress Event Management, Calendars & Registration Forums General Question Prevent page from jumping to the top when seach is clicked

This topic contains 1 reply, has 2 voices, and was last updated by  Stephen Harris 9 years, 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #17186

    Is there any way we can make the search shortcode work in a way that the page doesn’t jump to the top when you click the search button?
    Simply just show the results below?

    Thanks

    Mehrdad Emami
    #17213

    You can get the search form to jump to a particular part of the page using a #<element-id> where <element-id> is the value of the ID attribute of a HTML element.

    Specifically ensure the container for the search results as an ID, say “foobar”, then edit the search form so that its action targets that element, e.g.

     <form action="#foobar" ... >
    

    The form can be found in includes/shortcodes.php ~ line 184

    Stephen Harris
Viewing 2 posts - 1 through 2 (of 2 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.