javascript - Change the value of a variable after it's been set -


here's problem.

i have piece of code sets user location coordinates in textbox.

var initiallocation;            $('#from').val(initiallocation); 

the initiallocation variable gets user current location coordinates , $('#from').val(initiallocation); puts coordinates in textbox "from".

but instead of boring coordinates "45.542307, -73.567200" i'd textbox show "your location".

so basically, want have coordinates in textbox, change user sees "45.542307, -73.567200" "your location".

is possible such thing ?

thanks !

you can use data method of jquery stores data specific element

    $("#from").data("currentlocation", initiallocation).val("your location");  //to retrieve currentlocation $("#from").data("currentlocation"); 

Comments

Popular posts from this blog

actionscript 3 - TweenLite does not work with object -

php - How can I edit my code to echo the data of child's element where my search term was found in, in XMLReader? -

c# - Global Variables vs. ASP.NET Session State -