Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1123186

    `Hi there!

    Is it possible to add onclick event on menu links at header? The event is to link url or internal page. What I wanted to achieve is to change the HREF with an onclick event. for HTML here’s what I did.

    <a href="javascript:void(0);" onclick="window.location.href='https://example.com'">onclick link!</a>
    onclick link!

    • This topic was modified 5 years, 4 months ago by Rommel.
    #1123491

    Hey Rommel,

    Why do you need to use JavaScript if it is a normal link behavior to follow to the url provided and the link can be styled as a button if needed?

    Best regards,
    Victoria

    #1123536
    This reply has been marked as private.
    #1124017

    Hi,

    Thank you for the update.

    It’s not possible to add an onclick attribute by default but you can listen for a menu item click event.

    // https://api.jquery.com/on/
    // https://www.w3schools.com/jquery/event_on.asp

    Best regards,
    Ismael

    #1124194

    Hello,

    We are actually trying to deny crawlers from seeing some of the menu links. We want to avoid using nofollow. So making some link in the menu as javascript or something google bots cannot read is our only option. Would you have a suggestion?

    Thanks,
    Rommel

    #1124504

    Hi Rommel,

    Well, you need to use empty links for the menu and use some JavaScript to handle clicks on those items, but this is the customization that we do not provide within the scope of the support here, unfortunately.

    You might want to hire someone to do it for you.

    Best regards,
    Victoria

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.