mardi 19 avril 2016

How do I add this counter API to my clickHandler so it can count each click with its corresponding value?

In my html I have a form with 4 radio buttons. Each radio button represents an option the user can submit.

I have set up an event listener that listens for a radio button change event:

    [].forEach.call(document.querySelectorAll("input[type='radio']"),function(radio)
{
        radio.addEventListener("change", handleRadioClick);
});    

And this is how my click handler looks like:

function handleRadioClick()   //this code happens when user selects this radio button
{
  var label = document.querySelector("[for='"+this.id+"']");
  //execute more stuff here
}

I now need to add a Doubleclick counter API

    Enabler.counter('Option 1 was clicked'); //i.e.

so we can track what option has been clicked.

How would I go about accomplishing this? Thanks so much for any tips!

Note: Plain JS suggestions only please. Thanks!

Aucun commentaire:

Enregistrer un commentaire