Is it possible to use other variable in another function?

Is it possible to use other variable in another function?

    Basically I want to use selectedRS found on my first function to the second one

    1st Function
    1. $("#activityPane").on("change", "#rsOptionSelect", function() {
    2. var selectedRS = $("#rsOptionSelect :selected").text()
    3. $("legend").text( selectedRS );
    4. if(selectedRS != "Please Select A Reseller"){
    5. $("#rsOptionSelect").hide("slow").fadeOut("slow");
    6. $("#skuSetup").show("slow").fadeIn("slow");
    7. $("#skuSetupBtnDiv").show("slow").fadeIn("slow");
    8. }else{
    9. showSKUSetup()
    10. }
    11. });


    2nd Function
    1. $("#activityPane").on("click", "#cancelSetupBtn", function() {
    2.                                 alert(selectedRS );
    3. $("#skuSetup").hide("slow").fadeOut("slow");
    4. $("#skuSetupBtnDiv").hide("slow").fadeOut("slow");
    5. $("#skuSetupDiv").hide("slow").fadeOut("slow");
    6. $("#rsOptionSelect").show("slow").fadeIn("slow");
    7. });