Search not working on mobile version

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Search not working on mobile version

This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 4 years, 8 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #15377
    RED
    RED
    Participant

    Hi Support,

    The search doesn’t appear to be working on the mobile. I have deactivated the theme and set to WP default theme and it appears to work ok. I have backed up all files and database. Can you help as we really love the search function on the website. Hopefully you have all the necessary credentials to access the website.

    Regards

    Rob

    #15389
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Rob,

    It happens because the menu script creates a DOM copy of the search element, instead of showing the same one as on the desctop version. This is a very bad developer practice, as it essentially clones the original search bar, in this case creating invalid HTML output, as elements with the same ID will be present on the page multiple times. Cloning does not copy the event handlers either – that is why the copied search instance does not work.

    Some menu solutions do this, as they are designed to hold simple non-script powered elements, like a simple search form, links, images etc.. However in this case, there is a difference, as this search bar requires scripts to control it’s functionality – handling the live search requests, clicks on settings/magnifier buttons and many other different events. The plugin tries to correct this issue, however the duplicate element IDs prevent the script from initializing correctly.

    In these very rare cases I usually recommend either moving the search bar to a different position, or using a different menu solution, that uses custom CSS instead of cloning by script to move it’s elements.

    I have made a custom script that might be able to get around this issue, but please keep in mind that this is a very nasty solution, and may not work in all cases. Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #15404
    RED
    RED
    Participant

    Hi Ernest,

    Thank you for such a prompt response. I have added your script to functions.php and it works! I have only tested it on the iphone but will test on other mobiles as well. Excellent support – thank you.

    Regards,

    Rob

    #15408
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.