Avatar of greddin
greddin
Flag for United States of America asked on

Help with Javascript innerHtml please

I have a Javascript that is looping through a table's rows.  One of table cells (TD) contains a date.   Here's a sample:

<td class="ms-cellstyle ms-vb2"><span class="ms-noWrap" title="10/30/2015">10/30/2015</span></td>

Open in new window


I have a variable named "col_date" which needs contain just the date (10/30/2015).

var col_date = row.cells[suspense_date_column].innerHTML;

Open in new window


Right now col_date contains the whole  
<span class="ms-noWrap" title="10/30/2015">10/30/2015</span>

Open in new window

.  How can I return just the date without the span tag?

Thanks
JavaScript

Avatar of undefined
Last Comment
greddin

8/22/2022 - Mon
SOLUTION
Tom Beck

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Russ Suter

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Rainer Jeschor

+1 for Tom`s solution

Question: the HTML of the cell looks like a SharePoint generated table (at least the class names do :-))

Why dont you use jQuery?

Alternative solution:
var col_date = row.cells[suspense_date_column].getElementsByTagName('span')[0].getAttribute("title"); 

Open in new window


HTH
Rainer
greddin

ASKER
Thanks, both solutions are perfect. Appreciate the help!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck