I have a variable that is retrieved via a .click function and I want to pass it to another function but I"m having trouble passing it correctly because when I call the other function nothing happens.
var className;
var flavor;
(function ($) {
Drupal.myTest = Drupal.myTest|| {};
Drupal.behaviors.myTest= {
attach: function (context, settings) {
Drupal.myTest.myFunction= function (className) {
var passedVar= className;
alert(passedVar);
};
$('.buttons').on('click', function(event) {
className = $(this).attr('class');
});
$('#test').on('click, function(event) {
Drupal.myTest.myFunction();
});
}
};
}(jQuery));