The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
3 posters

    Remove pop up search

    EnigmaSpirit
    EnigmaSpirit
    New Member


    Posts : 6
    Reputation : 2
    Language : English

    Solved Remove pop up search

    Post by EnigmaSpirit Sat 23 Jan - 18:46

    Good Morning,

    I am trying to remove the pop up search from my forum and instead have the navigation bar just link to the search page. The code has the onclick property to fire the search box, I can't find a way to remove this as it's not accessible in the templates.

    Here's a screenshot of why I want to remove it, it falls behind the #wrap in my code.

    Remove pop up search Screen10

    My forum link is pogoraids.forumotion.com, accessible at pogoraiders.com.. Forum version is ModernBB

    Edit: the code that shows in dev console is

    Code:
    <a class="mainmenu" href="/search" onclick="showhide(document.getElementById('search_menu')); return false;" target="_blank">Search</a>

    So i tried to override using

    Code:
    const a = document.querySelector('.mainmenu');
    a.onclick = null;
    a.removeAttribute('target');

    However this does nothing.


    Last edited by EnigmaSpirit on Sat 23 Jan - 22:15; edited 1 time in total
    Niko
    Niko
    Helper
    Helper


    Male Posts : 3285
    Reputation : 254
    Language : English, Italian, French
    Location : Italy

    Solved Re: Remove pop up search

    Post by Niko Sat 23 Jan - 21:19

    Dear @EnigmaSpirit,

    have you tried with this?
    Code:
    $(function() {
        const a = document.querySelector('.mainmenu');
        a.onclick = null;
        a.removeAttribute('target');
    });

    Let me know :rose:
    EnigmaSpirit
    EnigmaSpirit
    New Member


    Posts : 6
    Reputation : 2
    Language : English

    Solved Re: Remove pop up search

    Post by EnigmaSpirit Sat 23 Jan - 22:04

    Niko wrote:Dear @EnigmaSpirit,

    have you tried with this?
    Code:
    $(function() {
        const a = document.querySelector('.mainmenu');
        a.onclick = null;
        a.removeAttribute('target');
    });

    Let me know :rose:

    This does not work.
    Niko
    Niko
    Helper
    Helper


    Male Posts : 3285
    Reputation : 254
    Language : English, Italian, French
    Location : Italy

    Solved Re: Remove pop up search

    Post by Niko Sat 23 Jan - 22:09

    @EnigmaSpirit try this one then Hello

    Code:
    $(function() {
    $('.mainmenu[href="/search"]').attr('onclick',null);
    });

    skouliki and SarkZKalie like this post

    EnigmaSpirit
    EnigmaSpirit
    New Member


    Posts : 6
    Reputation : 2
    Language : English

    Solved Re: Remove pop up search

    Post by EnigmaSpirit Sat 23 Jan - 22:14

    Niko wrote:@EnigmaSpirit try this one then Hello

    Code:
    $(function() {
    $('.mainmenu[href="/search"]').attr('onclick',null);
    });

    You are amazing, thank you!

    Niko likes this post

    skouliki
    skouliki
    Manager
    Manager


    Female Posts : 15391
    Reputation : 1709
    Language : English,Greek
    Location : Greece

    Solved Re: Remove pop up search

    Post by skouliki Sat 23 Jan - 23:38

    Problem solved & topic archived.
    Please read our forum rules: ESF General Rules


      Current date/time is Wed 13 Nov - 21:37