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 9099485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:37:53+00:00 2026-06-17T00:37:53+00:00

I have a page where i have two elements, an input textbox and a

  • 0

I have a page where i have two elements, an input textbox and a button

Now i have a blur event handler on the textbox, which first shows a jquery ui modal window and then makes an ajax request, once request is done, i am closing the dialog. Also i have a click event handler on the button(which also does sth).

Now when i type something in the textbox and directly click the button, both blur and click event handlers should fire, but it only fires blur and the click event is getting blocked because of jquery ui modal dialog(when i remove the dialog, both events are getting fired)

Here’s the sample code

    // the topic/subscription hash
var pubsub_cache = {};

$.publish = function(/* String */topic, /* Array? */args){
    // summary:
    //        Publish some data on a named topic.
    // topic: String
    //        The channel to publish on
    // args: Array?
    //        The data to publish. Each array item is converted into an ordered
    //        arguments on the subscribed functions.
    //
    // example:
    //        Publish stuff on '/some/topic'. Anything subscribed will be called
    //        with a function signature like: function(a,b,c){ ... }
    //
    //    |        $.publish("/some/topic", ["a","b","c"]);
    pubsub_cache[topic] && $.each(pubsub_cache[topic], function(){
        this.apply($, args || []);
    });
};

$.subscribe = function(/* String */topic, /* Function */callback){
    // summary:
    //        Register a callback on a named topic.
    // topic: String
    //        The channel to subscribe to
    // callback: Function
    //        The handler event. Anytime something is $.publish'ed on a
    //        subscribed channel, the callback will be called with the
    //        published array as ordered arguments.
    //
    // returns: Array
    //        A handle which can be used to unsubscribe this particular subscription.
    //    
    // example:
    //    |    $.subscribe("/some/topic", function(a, b, c){ /* handle data */ });
    //
    if(!pubsub_cache[topic]){
        pubsub_cache[topic] = [];
    }
    pubsub_cache[topic].push(callback);
    return [topic, callback]; // Array
};

$.unsubscribe = function(/* Array */handle){
    // summary:
    //        Disconnect a subscribed function for a topic.
    // handle: Array
    //        The return value from a $.subscribe call.
    // example:
    //    |    var handle = $.subscribe("/something", function(){});
    //    |    $.unsubscribe(handle);

    var t = handle[0];
    pubsub_cache[t] && $.each(pubsub_cache[t], function(idx){
        if(this == handle[1]){
            pubsub_cache[t].splice(idx, 1);
        }
    });
};

var $loaderDialog = $('<div>The dummy dialog</div>')
                                .dialog({
                                    autoOpen:false,
                                    modal:true
                                });

            $('.validate').on('change', function(){
                $loaderDialog.dialog('open');
                setTimeout(function(){
                    $.publish('validation-done');

                },3000)
            });

            $.subscribe('validation-done', function(){
                $loaderDialog.dialog('close');
                console.log('validation done');
            });

            $('#btn').on('click', function(){

                    alert('clicked');
            });

Here’s the JS fiddle for the same – http://jsfiddle.net/vjunloc/2Lw7S/7/

  • 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-17T00:37:54+00:00Added an answer on June 17, 2026 at 12:37 am

    Alrighty, so i finally found a workaround for this problem, firstly i checked the jquery modal dialog widget’s source, and at one place they are disabling all the events , so perhaps that was the culprit, now the workaround which i have done is

    $('.validate').on('change', function(){
                setTimeout(function(){
                       $loaderDialog.dialog('open');
                       setTimeout(function(){
                         $.publish('validation-done');
                     },3000)
                }, 100);
    
            });
    

    so basically i introduced a delay of 100ms, and by this time the control would be able to reach the click handler and thus it will get invoked, hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET page that has two input elements: A TextBox that is
I have these two elements in my page: <input type='button' value=undo style=display:none onClick =
I have a very basic page with two elements, an outer green box, and
I have a page with two buttons, one Button opens a popup window with
I have an ASPX page with two RequiredFieldValidator and a button to go to
I have two form elements on my page that act as a smooth login
I have a function which hides or shows elements with a given class name:
Assume that I have three elements on a page: A textbox that accepts a
I have a page that contains an element (a TextBox) that has two CSS
I have a page with two tabs that I want to be able to

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.