Skip to content

Instantly share code, notes, and snippets.

@there4
Forked from anonymous/Catching clicks
Created December 7, 2012 02:29
Show Gist options
  • Select an option

  • Save there4/4230265 to your computer and use it in GitHub Desktop.

Select an option

Save there4/4230265 to your computer and use it in GitHub Desktop.

Revisions

  1. @craig-davis craig-davis revised this gist Dec 7, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Catching clicks
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    formEvent: function () {
    formEvent: function (event) {

    console.log(event); // "Not defined!" -- Firefox
    eventType = event.target.type;
  2. @invalid-email-address Anonymous created this gist Dec 7, 2012.
    26 changes: 26 additions & 0 deletions Catching clicks
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    formEvent: function () {

    console.log(event); // "Not defined!" -- Firefox
    eventType = event.target.type;

    switch (eventType) {
    case "checkbox":
    classArray = event.target.classList;
    key = classArray[0];
    value = classArray[1];
    checkedStatus = event.target.checked;
    this.toggleShown(key, value, checkedStatus, "checkbox");
    break;
    case "radio":
    this.sortThingsByColumn(event.target.className);
    return this;
    break;
    case "select-one":
    value = event.target.value;
    key = event.target.classList[0];
    this.toggleSelect(key, value);
    break;
    default:
    break;
    }
    },