[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 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 selected inside the html() method ...
>
> obj.html (  obj.children().html()  )


[jQuery] Element Exact Width

2009-12-30 Thread ShenoudaB
Dears,

i was trying the width method whats get the width if the css property
width was declared or inherited.

but i was looking to get the exact width of the div, while not
specifying it in the CSS Style Properties.

as in the Width Jquery Documentation Example:



  http://code.jquery.com/jquery-latest.js";>

  
  $(document).ready(function(){

function showWidth(ele, w) {
  $("div").text("The width for the " + ele +
" is " + w + "px.");
}
$("#getp").click(function () {
  showWidth("paragraph", $("p").width());
});
$("#getd").click(function () {
  showWidth("document", $(document).width());
});
$("#getw").click(function () {
  showWidth("window", $(window).width());
});

  });
  
  
  body { background:yellow; }
  button { font-size:12px; margin:2px; }
  p { border:1px red solid; }
  div { color:red; font-weight:bold;  }
  


  Get Paragraph Width
  Get Document Width
  Get Window Width
   
  
Sample paragraph to test width
  



I remove the width of the p tag from style.
i got the width value of the p tag  equals to the Document Width and
Window Width.

while i need to get the exact width size of the content of the p tag
"in that case text".
get the width of the text included in the p tag.

Please, help me in that issue.

Thanks,
Shenouda Bertel