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
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
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
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"));
1 error in the code above, this is right:
var width = $("p").wrapInner("").children().width();
$("p").html($("p").children().html());
var width = $("p").wrapInner("").children().width();
$("#myp").html($("p").children().html());
6 matches
Mail list logo