[Wylug-help] extra HTML properties for access by javascript
James Holden
wylug at jamesholden.net
Thu Feb 4 12:08:08 UTC 2010
On Thu, 2010-02-04 at 11:48 +0000, Gary Stainburn wrote:
> Hi folks.
>
> I have table with an onclick event that I want to pass arguments to based on
> the TR that is clicked.
>
> In other words I want to add extra properties to the TR object. I can do this
> within javascript, but can I do it straight from HTML? I want to do something
> like:
>
> <TR id="13" VehID="20">
>
> so that in javascript I can then read vehID as a property of the TR object
>
> In Mozilla, it just ignores any properties it doesn't expect. Not tried it in
> IE yet
>
> Gary
Gary,
Stick a hidden field in the first td?
eg:
<tr>
<td><input type="hidden" value="foo">cellcontent</td>
</tr>
If you're using a framework such as jQuery it's trivial to reference
hidden it from the row in which it sits.
There are probably more elegant ways too, of course.
James
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://mailman.lug.org.uk/pipermail/wylug-help/attachments/20100204/c8246284/attachment.pgp
More information about the Wylug-help
mailing list