Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8233007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:59:45+00:00 2026-06-07T17:59:45+00:00

I have a select dropdown and if a user clicks ‘outside’ of that select

  • 0

I have a select dropdown and if a user clicks ‘outside’ of that select dropdown, I want it to disappear. This is what I currently have:

$(this).html($("<select/>", {
  id: 'sel',
  change: function() {
    selectdone(this, title_id, status_type);
  },
  blur: function() {
    selectdone(this, title_id, status_type);
  },

In the above, if I click outside of the dropdown, nothing happens. The only time the function is firing is if I change the value of the select dropdown.

How would I accomplish the above, such that when a user clicks anywhere on the document outside of the select dropdown, it fires this function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:59:45+00:00Added an answer on June 7, 2026 at 5:59 pm

    I don’t think this is possible. As pointed out in another answer, it appears that the active <select> is prohibiting other input from being accepted.

    See my updated fiddle. Notice that when you click the background you get the alert test when the select isn’t expanded. When it is expanded and you click off, the alert doesn’t fire. This appears to be the default behavior of the browser. It appears to be ignoring all other inputs (mouse movements included) while the select is activated.

    I was, however, able to get your event to fire for any selected element by setting the selectedIndex to -1. This way any valid option will result in a change.

    Example

    $(function(){    
        var title_id = '', status_type = ''; 
        $('body').html(
            $("<select/>", {
                id: 'sel',
                change: function() {
                    selectdone(this, title_id, status_type);
                },
                blur: function() {
                    selectdone(this, title_id, status_type);
                }
            })
            .append($('<option />', { 'text':'one'}))
            .append($('<option />', { 'text':'two'}))
        );
    
        $('#sel').prop('selectedIndex', -1); 
    });
    
    function selectdone(element, titleid, statustype){
        $(element).hide().prop('selectedIndex', -1); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple html option/select (dropdown) menu. I want to use JQuery to
I have an ASP.NET DropDownList control that renders into a dropdown list (select HTML
I have a dropdown box where the user can select a method to check
i have a form that has a multiple select drop down. a user can
I have a drop down select box inside a div. When the user clicks
I have a fancybox that is shown when a user clicks a button. The
I have an html form with a lot of options that a user would
Dropdown In my site I have a set of SELECT dropdowns that are set
Say I have this dropdown: <select id=theOptions1> <option value=1>1</option> <option value=2>2</option> <option value=3>3</option> </select>
I have a dropdown that is initialized with one single value. When the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.