Button text change via click event and sending geo data

Button text change via click event and sending geo data

Hello guys I am new to jQuery and developing an app for a tablet with geolocations. I have a question about a button text I want to change. I have a button named vlock with the text "Lock". If I click the button the text should change to "Unlock" and the current position should be send to a msg box.
So I can change the button from "Lock" to "Unlock" once! But this should be change whenever the button is clicked. also I could not get it working to send the geo data in a msg box. maybe someone here can help me with it. here is a code snipped:

    $(".tmaction").click(function(e){
   
        console.log(e.target);
   
           
        if (e.target.id == "vlock" ) {
           
                document.getElementById("vlock").text = "Unlock";
           
            }
           
        else {
           
                document.getElementById("vlock").text = "Lock";
           
            }
   
 
        postupdate();