By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,717 Members | 1,233 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,717 IT Pros & Developers. It's quick & easy.

resize textarea on Safari

P: n/a
The following script is intended to grow the textarea
when the user first gives it focus. This seems to work
on most browsers, but does nothing on Safari on the Mac
(the rows and columns are updated internally, but the
textarea does not expand onscreen).

Any ideas why it doesn't work, or if there are any
workarounds?

Thanks
Mark

<html>
<body>
<script>
function expandpost(t) {
t.rows = 6;
t.cols = 60;
}
</script>
<textarea name=comments cols=40 rows=2
onFocus="javascript:expandpost(this);">blah
</textarea>
</body>
</html>
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I am working around the same problem. The rows and cols attributes in
Safari only affect the actual rows and cols inside the textarea, rather
than affecting the viewable area.

For your needs, you can simply use my first solution. Just put:

if ([test for safari]) {
t.outerHTML = '<textarea name=comments cols=60 rows=6></textarea>';
}

*Should* work. Unfortunately for me, I am trying to resize the textarea
on the fly, and this causes the browser to loose focus of the textarea.

I am also trying to figure out how to get a textarea to accept the border:
none; style, and kill the glowing focus around the textarea. Anyone know
anything about this in Safari?

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.