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:
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$
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
;
}
;
}
;
</script>
<style>
body { background:yellow; }
button { font-size:12px; margin:2px; }
p { border:1px red solid; }
div { color:red; font-weight:bold; }
</style>
</head>
<body>
<button id="getp">Get Paragraph Width</button>
<button id="getd">Get Document Width</button>
<button id="getw">Get Window Width</button>
<div> </div>
Sample paragraph to test width
</body>
</html>
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