473,378 Members | 1,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

not getting focus in textarea.

I want to place a cursor by default in a textarea.The editor is in a hidden div, and when a button is clicked, the div displays. Instead of making the user click in the editor to begin typing, I want the editor focused so they can start adding content immediately.
Jun 1 '10 #1
3 3196
Dormilich
8,658 Expert Mod 8TB
I’d guess you should apply .focus() to the editor’s <textarea>
Jun 1 '10 #2
@Dormilich
Thank you Dormilich ,but it didn't work.I tried it.


I you would have any other alternetive then please let me know..
thank you
Jun 1 '10 #3
phvfl
173 Expert 100+
@dinesh1985singh
Should be working for you. Given html of
Expand|Select|Wrap|Line Numbers
  1. <div id="editorDiv" style="display:none;">
  2. <textarea id="myEditor" name="myEditor" cols="30" rows="6"></textarea></div>
  3.  
The following javascript should do what you want:
Expand|Select|Wrap|Line Numbers
  1.   var container = document.getElementById("editorDiv"), editor = document.getElementById("myEditor");
  2.   container.style.display="block";
  3.   editor.focus();
  4.  
Jun 5 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: s_m_b | last post by:
I'm trying to get an <a> element to gain the focus onload, but only get back 'has no properties'. Reading through this ng, its clear that unless the element is within a form, this doesn't happen,...
4
by: Mr. T | last post by:
Hi, I need some help here. I have a On Exit procedure on that opens a form. Whenever anyone clicks anything outside of it the form opens. No problem here. But I need it not to open if the...
8
by: Susan Bricker | last post by:
Hi. I am opening a form (frmUserSettings) just before (or so I thought) the Main Menu form (frmMainMenu) is opening but it's not getting the focus. It gets "painted" and then the Main Menu gets...
5
by: Petec | last post by:
Is there a way to prevent a form from getting focus? Thanks! - Pete
5
by: Kathy Burke | last post by:
Hi, I've used the following javascript structure in other places in my asp.net app, but for this one the pop-up window still goes to the back and doesn't get the focus. button onclick event:...
1
by: Tedmond | last post by:
Dear all, How to prevent a datagrid in Windows form getting focus? Even user click on it. I use barcode scanner as input and display the result in a datagrid. My problem is when the...
1
by: harinibiligiri | last post by:
I'm using Javascript in my jsp. How do I get the name of the current control which has focus.
1
inch
by: inch | last post by:
I would like to pop up a small information window (form) while my application is running to remind the user about something. However it should not get focus as this could intefere with what the user...
2
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Hi all! I have one combobox, two grids and nine textbox. All textbox are tab index one following another. When I press tab I go to the next textbox. How can I known if I click on another...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.