By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,473 Members | 1,278 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,473 IT Pros & Developers. It's quick & easy.

An Attribute of a Parent Element?

P: n/a
Hi.

Could some kind sould tell me what the javascript would be to get a
given attribute of the parent "table" element of a given element
inside that table.

So,

<table width="54">
[SNIP - LOTS OF HTML HERE]
<a href="#" onclick="Foo();">get the width attribute's value</a>
</table>

When I click on the anchor tag, it returns the number "54".

How do I do this?

Oct 17 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
pbd22 wrote:
Hi.

Could some kind sould tell me what the javascript would be to get a
given attribute of the parent "table" element of a given element
inside that table.

So,

<table width="54">
[SNIP - LOTS OF HTML HERE]
<a href="#" onclick="Foo();">get the width attribute's value</a>
</table>

When I click on the anchor tag, it returns the number "54".

How do I do this?
Give the table an ID and getElementById on it.
Oct 17 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.