Skip to content

Instantly share code, notes, and snippets.

@vkareh
Last active Dec 14, 2015
Embed
What would you like to do?
<?php
/**
* Implements hook_form_FORM_ID_alter() for views_exposed_form.
*/
function MODULE_form_views_exposed_form_alter(&$form, &$form_state) {
$form['#after_build'] = array('_MODULE_apply_js');
}
function _MODULE_apply_js($form, &$form_state) {
drupal_add_js(drupal_get_path('theme', 'wsup') . '/scripts/script.js');
return $form;
}
(function ($) {
Drupal.behaviors.wsupStyleFilters = {
attach: function (context, settings) {
console.log('JS Loaded!');
$('input[type=checkbox]:checked').next('label').addClass('selected');
$(".views-exposed-form select").styleSelect();
$(".views-exposed-form select").change(function() {
console.log('Filter Changed!');
// $(this).parents("form").submit();
}
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment