Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML Element Text not set correctly

Status
Not open for further replies.

IjumpOverU

Technical User
Jul 31, 2003
43
US
While I am quite sure this stupidly simple (and I think I dealt with it before) my brain is currentlt fried so I am asking for assistance.

On my html/js page I have a simple <span> tag which during actions on the page (no reload or refresh) gets a text value...

From - <span id="eleText" style="text-decoration:underline; cursor:pointer"></span>

To - <span id="eleText" style="text-decoration:underline; cursor:pointer">Status:Complete</span>

Yet when I try to retrieve this "Status:Complete" value in script I get an empty string. I know that the value is there I can see it on the page and when debugging the html structure. Javascript (and JQuery) do not see it.

var curTags = $('#eleText').text();
 
We'd need to see more code to do anything other than guess.

How are you setting the value?
Where are you running the $('#eleText').text(); function?
Where are you checking the curTags variable to see that its empty?
Are you sure the span's id is correct. JS is case sensitive. so eleText would be different to eletext or even EleText.
Do you have more than one element with that ID?

In other words we'd need to see some context for the code, because as it stands it should work.


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top