Home Search Member List Faq Register Login  
JavaScript Tips
Move the focus away from your dropdown after change event

Thread Starter: Karamasoft   Started: 09-18-2007 12:45 PM   Replies: 0
 Karamasoft Support Forums » General Discussions » JavaScript Tips » Move the focus away from your dropdown after change event
 Printable Version    « Previous Thread   Next Thread »
  18 Sep 2007, 12:45 PM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Move the focus away from your dropdown after change event

When the user changes the selection in a DropDownList, the focus remains inside the dropdown. If the user presses up/down arrow key or moves the mouse wheel, that action triggers the onchange event on the dropdown.

You can prevent this by making the dropdown lose focus in the onchange event.

JavaScript

function LoseFocus(ddlElem) {

ddlElem.blur();

}

ASPX

<asp:DropDownList id="ddlLoseFocus" runat="server" AutoPostBack="true" />

C#

protected void Page_Load(object sender, EventArgs e)

{

ddlLoseFocus.Attributes.Add("onchange", "LoseFocus(this)");

}


  
 Page 1 of 1 (1 items)
Karamasoft Support Forums » General Discussions » JavaScript Tips » Move the focus away from your dropdown after change event

You can add attachments
You can post new topics
You can reply to topics
You can delete your posts
You can edit your posts
You can create polls
You can vote in polls
Forum statistics are enabled
Forum is unmoderated

© 2002-2018 Karamasoft LLC. All rights reserved.