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

  • Home
  • SEARCH
  • 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 8363939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:18:42+00:00 2026-06-09T12:18:42+00:00

I want to use a jQuery UI dialog to display the errors in the

  • 0

I want to use a jQuery UI dialog to display the errors in the different inputs. My problem is that I would like to define the feature of dialog box only one but associate it with several html containing an id and a specific error message.

How could I do that?

At the moment, I have this:

// definition of the dialog, to do only once
$( "#dialog" ).dialog({
    autoOpen: false,
    show: {effect: 'fade', speed: 100},
    hide: {effect: 'fade', speed: 100},
    modal: true,
    resizable: false,
    title: "Incorrect value",
    buttons: {  Ok: function() {    $(this).dialog( "close" );  }},
    beforeClose: function() {   $( "#time_at_address_years1" ).focus().val('')  },
});

// the event, one per input
$( "#time_at_address_years1" ).blur(function() {
    $( "#dialog1" ).dialog( "open" );
    return false;
});

And the HTML of one message is like this:

<div id="dialog">
<p>The error message here.</p>
</div>
  • 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-09T12:18:43+00:00Added an answer on June 9, 2026 at 12:18 pm

    Just warp the dialog in a function and pass that function the current jQuery-selector.

    function my_dialog(selector, tofocus) {
     $(selector).dialog({autoOpen:true, ...more options...});
    }
    

    Than call it like this:

    $( "#time_at_address_years1" ).blur(function() {
     my_dialog('#dialog1', '#time_at_address_years1');
     return false;
    });
    

    Also, you should have a look at the jQuery-Validator-Plugin http://docs.jquery.com/Plugins/Validation

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

Sidebar

Related Questions

Mobile browsers. Jquery dialog alert box. I don't want to use alert() because it
If I want to use a jquery dialog in order to display an error
If I want to use a jquery dialog in order to display an error
I want to use jQuery UI dialog box to open a form dialog where
If I want to use a jquery dialog in order to display an error
I want to use jQuery tabs ( http://jsfiddle.net/43FcS/2/ ) inside a div that's created
I want to use a JQuery UI dialog but i can't. when I click
I am trying to use a jquery dialog box as a sign up form
I'm new to jQuery, and now I want to use jQuery-UI Dialog to show
I want to use jquery dialog with my custom buttons but I don't want

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.