1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Looking for an advice from javascript expert

Discussion in 'HTML & JavaScript' started by Ilias, Feb 27, 2016.

Tags:
  1. Ilias

    Ilias Regular Member

    Joined:
    Jun 18, 2013
    Messages:
    379
    Likes Received:
    63
    Location:
    Morocco
  2. Sergey Yermak

    Sergey Yermak Newbie

    Joined:
    Mar 12, 2016
    Messages:
    31
    Likes Received:
    3
    Gender:
    Male
    Occupation:
    Node.js
    Can u edit your links html when u adding them into ur site? I wrote something like that for myself. U need to add additional attribute with ref data inside ur link.
     
  3. ab320012

    ab320012 Newbie

    Joined:
    Mar 20, 2016
    Messages:
    8
    Likes Received:
    0

    Hi there, This will probably be easier.

    Code:
    $('a').click(function (e) { e.preventDefault; window.location = "Youreurl" })

    not sure how much JS or web development you know but basically e.preventDefault stops from going to the URL that was referenced, window.location sends them to the page specified by quotes. All of this is wrapped in the .click jquery function. I put ('a') as the selector but you can select whatever tag you want like this: $('#id'). the id in this case is the id associated with whatever you're clicking on, you can add it to the html. Hope this helped, DM me if you need more help.
     
    Last edited: Mar 20, 2016