JQuery pass a variable from function to function
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.
$('.buttons').click(function() {
var className = $(this).attr(class);
});
myFunction = function (className) {
myPassedVar = className;
alert(myPassedVar);
};
$('#test').click(function() {
myFunction();
}
No comments:
Post a Comment