I have 2 constantly updating spans with coordinates in them. These spans are updated from a separate js file that someone else wrote that is VERY sensitive to changes.
I can see the spans just fine and they are updating the coordinates just fine, however I need to pass them as variables though in a link. For example, I have a link on page some.php?var1=[value of constantly updating div1]&var2=[value of constantly updating div2] that I need the user to be able to click.
I need this link to, when clicked, either gets the value of the spans and submits it to a page handler (some.php in this case) or is just constantly updated from the spans. I’ve tried to get the innerHTML value of the spans, it doesn’t seem to be working though to constantly update them….
Let’s say your
<span>elements have IDs:Then just construct a placeholder link:
And the following jQuery should do the trick:
You also might want to consider using encodeURIComponent() on the values of your
<span>elements to make sure they get passed correctly, unless you’re always sure that the format of the value is URI-safe.