[jQuery] Re: Element Exact Width

2010-01-05 Thread ShenoudaB
Thanks, that solutions works fine. thanks for your Help and Happy new year 2010 On Jan 2, 2:47 pm, Šime Vidas wrote: > obj.html(obj.children().html()); > > obj.children() selects the SPAN that we created... > obj.childern().html(), therefore, returns all the content of the SPAN, > which was orig

[jQuery] Re: Element Exact Width

2010-01-02 Thread Šime Vidas
obj.html(obj.children().html()); obj.children() selects the SPAN that we created... obj.childern().html(), therefore, returns all the content of the SPAN, which was originally the content of the P we want to set the content back from the SPAN to the P... so, we have to put the content that we sel

Re: [jQuery] Re: Element Exact Width

2010-01-01 Thread Leonardo Balter
Vidas, I got stuck on what you did in the 'obj.html(obj.children().html());' Isn't it a redundancy or I'm missing something? 2010/1/1 Šime Vidas > > Better yet, make a function that you can reuse: > > function contentWidth(obj) { >var width = obj.wrapInner("").children().width(); >obj

[jQuery] Re: Element Exact Width

2010-01-01 Thread Šime Vidas
Better yet, make a function that you can reuse: function contentWidth(obj) { var width = obj.wrapInner("").children().width(); obj.html(obj.children().html()); return width; } Now you can use the function like this... var width = contentWidth($("#myp"));

[jQuery] Re: Element Exact Width

2010-01-01 Thread Šime Vidas
1 error in the code above, this is right: var width = $("p").wrapInner("").children().width(); $("p").html($("p").children().html());

[jQuery] Re: Element Exact Width

2010-01-01 Thread Šime Vidas
var width = $("p").wrapInner("").children().width(); $("#myp").html($("p").children().html());