Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-28-2009, 10:52 PM   PM User | #1
hacking_mike
New to the CF scene

 
Join Date: Oct 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
hacking_mike is an unknown quantity at this point
keep or set focus on site when using .load

I have a text selected on my site. Then I click a button which uses the load function to show a html form in a dialog. When I start filling out te form, the focus on my selected text is lost (text is deselected). How can I keep the focus or get it back when the dialog closes?
hacking_mike is offline   Reply With Quote
Old 10-29-2009, 12:23 AM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
Are you talking about "focus" (the cursor is sitting in the text box ready for entry), or "selected text" (you've dragged your mouse over some text to highlight it)? Two different things and we can manipulate one (focus) via Javascript but not the other (highlight).
__________________
Fumigator is offline   Reply With Quote
Old 10-29-2009, 08:08 AM   PM User | #3
hacking_mike
New to the CF scene

 
Join Date: Oct 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
hacking_mike is an unknown quantity at this point
I'm talking about selected text but maybe focus might work. How do I do that?
hacking_mike is offline   Reply With Quote
Old 10-29-2009, 05:09 PM   PM User | #4
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
The load function can have a callback function which will be executed once the Ajax call returns from loading an element. You can put any Javascript or jQuery commands in that callback; jQuery has a focus() function you can use.

http://docs.jquery.com/Ajax/load#urldatacallback

http://docs.jquery.com/Events/focus
__________________
Fumigator is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:49 PM.


Advertisement
Log in to turn off these ads.