Get value from HTML Tag (span)

Dear All,

How can I get value from span?
<form action="" method="POST">
<span id="test">2015-06-10 - 2015-06-21</span>

Open in new window

arkam chouAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
With javascript you can do the following

var s = document.getElementById('test').innerHTML;
var d = document.getElementById('test').textContent || document.getElementById('test').innerText;

With JQuery

var x = $('#test').text();
var y = $('#test').html();

If you want to submit the value with the form and retrieve it on the server - can't
arkam chouAuthor Commented:
yes, I want to submit that value with php. I want to get date value from span in bootstrap-datepicker and submit that value to php.
arkam chouAuthor Commented:
can I transfer value from span to hidden textbox when have any change on span? if can, how to do it?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Julian HansenCommented:
can I transfer value from span to hidden textbox when have any change on span?
I don't understand - <span> is not an input element - it contains static text so not sure what you mean when you say "have any change on span"?
arkam chouAuthor Commented:
I use 
when I pick any date, it will give value to span. so I want to use that value in span with form.
Julian HansenCommented:
when I pick any date, it will give value to span
A) How?
B) Why?

Why are you assigning a date to a span and not an input element?
arkam chouAuthor Commented:
I not assign it myself. I use date-picker from this web 
and I saw when I pick date, the value was change in span.
Julian HansenCommented:
Yes but standard practice is to link the datepicker to an input element not a span.

There is no benefit linking to a span as this is not a form element - it won't be passed back to the server when you submit.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.