Alternative way of calling javascript function

I barely ever code any more but of course ever now and then I get curious. I saw this code and I'm not sure how it works? I'm curious about the data-omni variables. Obviously it is calling some function and passing an argument to it but how does it work? Where do I find the function it is calling? I've never seen a function called in this manner before?

<a href="//"
title="" class="btn btn-fifa"
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Julian HansenConnect With a Mentor Commented:
The link is storing meta data using the html5 user data attributes. Anything prefixed by data- is definied as user defined data.

I would imagine there is an event handler (JQuery or plain JS) bound to the click of that <a> that then picks up those attributes and does something with them

$(function() {
  $('a').click(function(e) {
    e.preventDefault(); // If we don't want the normal click away from page to fire
    var event = $(this).attr('data-omni-event'); // event now contains 'retailerClick'
    var args = $(this).attr('data-omni-args'); // args now contains 'purchase_click_origin_xbox360'

   $.post('tosomeurl.php', {event: event, args: args}, function(response) {
     // do something with the response.

Open in new window

894359Author Commented:
anyway to figure out what this is bound to?
894359Author Commented:
Thanks a million! Much appreciated!
Julian HansenCommented:
You are welcome - thanks for the points.
All Courses

From novice to tech pro — start learning today.