Replacing JS Function
Replacing JS Function
New to JQuery, but making progress, not sure how to describe this issue, so stay with me.
In JS I would build a function that I could call from a variety of actions, including other functions.
eg..
-
function dosomething(someparam){
// does something.
}
function dothis(){
//do this thing, then...
dosomething('somevalue');
}
In JQuery I would call a method using the selector
eg.
-
$('#someselectorID').click(function(){
alert('you clicked on this thing');
});
What I can't see yet, is how to call the action assigned to that selector from another method. (Just as I would call another function in JS.)
ie.
-
$('#someotherselector').click(function(){
alert('Ok, what did you do?');
//now call the method associated with the #someselectorID
});
Then I could call that common action from any method.
I'm sure it's a dumb question and have been looking all over for the solution, I assume there is one, but that might be wrong too.
TIA!