Skip to content

Instantly share code, notes, and snippets.

@logaretm
Last active May 3, 2017 11:43
Show Gist options
  • Select an option

  • Save logaretm/13f9f0fa1df5b1ecf1e5 to your computer and use it in GitHub Desktop.

Select an option

Save logaretm/13f9f0fa1df5b1ecf1e5 to your computer and use it in GitHub Desktop.

Revisions

  1. Abdelrahman Awad revised this gist Feb 3, 2016. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions directives.js
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,6 @@ Vue.directive('clean', {
    },

    unbind() {
    $(this.el).unbind(this.onSubmit)
    $(this.el).unbind('submit', this.onSubmit)
    }
    });

  2. Abdelrahman Awad created this gist Feb 3, 2016.
    17 changes: 17 additions & 0 deletions directives.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    // Cleans GET query parameters by disabling empty inputs using jquery.
    Vue.directive('clean', {
    onSubmit() {
    $(':input', this).each(function() {
    this.disabled = !($(this).val());
    });
    },

    bind() {
    $(this.el).submit(this.onSubmit);
    },

    unbind() {
    $(this.el).unbind(this.onSubmit)
    }
    });