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

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -