/    Sign up×
Community /Pin to ProfileBookmark

IF Statement based on <td id="myCell">

Is there a JavaScript statement that will identify the contents of a table cell? I’m trying to build a function with an ‘if statement’ based on the contents of an existing table cell on the same page. Is this poss???

function check_table_data()
if the TD = “whatever”
{
do this
}
else
{
do the other
}

Thanks

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@scott68authorApr 13.2005 — The table is an include, so the data will change, in case anyone was wondering.
Copy linkTweet thisAlerts:
@FangApr 13.2005 — If the contents is just text:

document.getElementById('myCell').firstChild.data=cellText;
Copy linkTweet thisAlerts:
@scott68authorApr 13.2005 — Works just fine, appreciate it.
×

Success!

Help @scott68 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...