glenelkins Posted December 5, 2008 Share Posted December 5, 2008 Hi I have an unordered list like this <ul> <li id="idname"><a href="">bla bla</a></li> </ul> here is my JS code...its not showing me the width of "idname"...help!! please lol // Get menu item left pos var currentEl = document.getElementById ( 'idname' ); alert ( currentEl.getAttribute( "width" ) ); Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted December 5, 2008 Share Posted December 5, 2008 Hi I have an unordered list like this <ul> <li id="idname"><a href="">bla bla</a></li> </ul> here is my JS code...its not showing me the width of "idname"...help!! please lol // Get menu item left pos var currentEl = document.getElementById ( 'idname' ); alert ( currentEl.getAttribute( "width" ) ); Does your <li> have a set width? Because unless it's set, it'll just be the default width, which is slightly smaller than the width of the list's (<ul>) containing element. I doubt this attribute would have a concrete number in terms of pixels, due to the way it's generated. Quote Link to comment Share on other sites More sharing options...
glenelkins Posted December 8, 2008 Author Share Posted December 8, 2008 hi the width is set in the CSS Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.