I have a table where each td has its width declared in css rules. Inside some "td" i have either "p" or "div" I want to have these elements inherit the width of the parent td. I have a sample here - http://www.roxstyle.com/projects/blssi/cms/user-tools-v1/user-search.html if you click on the "user" search, you will get a results table and several of the td have got purposely long (non-spaced text) the tds have a width within css, but the div does not inherit that. If i give the div the pixel width, with overflow:hidden - i get the results i want -the table structure stays in place and the extra text is hidden i would like to make a function that would globally give the css width of each td to its children
im trying things like: $(document).ready(function(){ var d = (".tbl tbody td div"); var d_p = $("d").parent('td'); function inheritWidth() { $("d").width(d_p.innerWidth()); } }); i know my knowledge of js is basic. Is there any tutorial, or a sample on the jquery site that is similar to this functionality i am looking for?