I’ve added a custom attribute to <TR> rows of a table and then my code searched over all rows through the values of this attribute. This is how to print all fields of an object:
var attrs= ”;
for( var attr in theObject ) {
attrs+= attr+’, ‘;
}
alert( attrs );
And to get value of a custom attribute (e.g. ‘custom_data’): row.getAttribute( ‘custom_data’ )
June 20, 2008
Getting all properties and custom attributes of a Javascript object
1 Comment »
RSS feed for comments on this post. TrackBack URI
Thanks for this valuable code
Comment by Firas Nizam — January 1, 2009 @ 6:38 am |