[jQuery] Re: getting DOM values
$('#foo')[0].clientWidth On 5/29/07, pd [EMAIL PROTECTED] wrote: Hi BjQ (before jQuery) I can do this: document.getElementById('foo').clientWidth to get a DOM value that Firebug tells me is set to something other than 'undefined'. I can't figure out how to the do same in AjQ (after jQuery). I've tried the following: $('#foo').attr('clientWidth') but keep getting undefined. Am I trying the wrong syntax? If so, what syntax will achieve the results I'm after? -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
[jQuery] Re: getting DOM values
You can access the regular dom properties/methods by extracting the element from the jQuery collection. $('#foo').get(0).clientWidth You can also just use bracket notation. $('#foo')[0].clientWidth You could also use the Dimensions plugin which helps abstract some cross browser issues with widths, heights and offsets. http://jquery.com/plugins/project/dimensions -- Brandon Aaron On 5/29/07, pd [EMAIL PROTECTED] wrote: Hi BjQ (before jQuery) I can do this: document.getElementById('foo').clientWidth to get a DOM value that Firebug tells me is set to something other than 'undefined'. I can't figure out how to the do same in AjQ (after jQuery). I've tried the following: $('#foo').attr('clientWidth') but keep getting undefined. Am I trying the wrong syntax? If so, what syntax will achieve the results I'm after?
[jQuery] Re: getting DOM values
Here are the docs for .get( Number ) http://jquery.bassistance.de/api-browser/#getNumber -- Brandon Aaron On 5/29/07, pd [EMAIL PROTECTED] wrote: Thanks guys, super-fast reply :) Is this documented anywhere? I've scanned through the API and didn't see anything for what seems to be a pretty fundamental requirement from a JS library, don't you think? I understand if people haven't had the time to include this in the doco though.