Forums

Add onMouseDown to all external (outbound) links. (2 posts)

  1. matthewcarter
    Member
    Posted 10 months ago #

    I am needing to add an onMouseDown attribute dynamically (onMouseDown="xml_sclk(this);") to all outbound links for tracking purposes for an API. I assume this can easily be done with jQuery or JS but those areas are not my area of expertise.

    Could anyone provide an example of code or a reference for accomplishing this?

    Thanks in Advance,
    Matt

  2. Andrew Bartel
    Member
    Posted 10 months ago #

    You'd have to give your links some sort of css class as an identifier. I don't know if you can globally bind something to all strictly outbound links.

    That said, you're going to want to use jquery's bind, where the callback function is your xml_sclk(). I'd recommend onclick (or 'click' in jquery) rather than onmousedown as well.

Reply

You must log in to post.

About this Topic

Tags

No tags yet.