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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:30:25+00:00 2026-06-08T08:30:25+00:00

I have the following jQuery Tools overlay: <div id=’editDescriptiontOverlay’ class=’overlay’> <input type=’text’ class=’description’/> <button

  • 0

I have the following jQuery Tools overlay:

<div id='editDescriptiontOverlay' class='overlay'>
  <input type='text' class='description'/>
  <button class='save'>Save</button>
  <button class='close'>Cancel</button>
</div>

Background info: The HTML for this overlay is static. I have a list of items each having their own Edit link. When a given Edit link is clicked, the overlay is generated by calling: $('a[rel=#editDescriptionOverlay]').overlay( { ... } ); and the input is populated with the respective text.

The Save button needs to validate the text in the input element and close the overlay if and only if the validation is successful. Otherwise, the overlay must remain open. The Cancel button simply closes the overlay without validation.

The validation logic has been independently verified to work.

I’ve tried setting the onBeforeClose event during overlay generation as a means of validation. Taking this approach, both the Save and Cancel buttons needed the same class .close. Unfortunately, the condition applies to all .close elements in the overlay so even the Cancel button was validating.

I’ve also tried binding a click event to the Save button immediately after generating the overlay, like so:

$('.save', $('#editDescriptionOverlay'))
  .unbind('click')
  .bind('click', function() {
    if (validateText) {
      console.log("Validation passed.");
      $('a[rel=#editDescriptionOverlay]').overlay().close();
    }
    else {
      console.log("Validation failed.");
    }
  });

The console.log’s confirm that the validation is working, but the overlay doesn’t close.

Any insight is appreciated, thanks.

  • 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-08T08:30:26+00:00Added an answer on June 8, 2026 at 8:30 am

    For jquery widgets, public methods should be called as follows:

    $(‘a[rel=#editDescriptionOverlay]’).overlay(“close”);

    wherein close is the method name that you wish to call.

    If a method accepts parameters, then, these should be added as parameters right after the method name.

    Updated:

    I am sorry. I just had time to check what jQuery Overlay Tools is and I am mistaken. This is not similar to any jQuery widget, hence, my comment above will also not work for this case. I tried your code above and it worked. The overlay was closed. But, when I tried it with multiple <a rel="#editDescriptionOverlay">, which I think is what you did. It did not work. My suggestion would be to use just one <a rel="#editDescriptionOverlay"> and use a dummy anchor element for the Edit link, which when clicked would trigger a click to <a rel="#editDescriptionOverlay">. You can do something like this:

    <script type="text/javascript">
    
        $(document).bind("ready", function(e){
            $("a[rel]").overlay();
            $('.save', $('#editDescriptionOverlay')).unbind("click").bind("click", function(){
                if (validationValue){
                    $("a[rel=#editDescriptionOverlay]").overlay().close();
                }
            });
        });
    
        function clickThis(){
            $("a[rel=#editDescriptionOverlay]").trigger('click'); 
            return false;
        }
    </script>
    
    <a href="#" onclick="return clickThis();">Edit1</a>
    <a href="#" onclick="return clickThis();">Edit2</a>
    
    <a rel="#editDescriptionOverlay">Dummy</a>
    
    <div id='editDescriptionOverlay' class='overlay'>
      <input type='text' class='description'/>
      <button class='save'>Save</button>
      <button class='close'>Cancel</button>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following tabs in jquery-tools: <!-- tabs --> <ul class=css-tabs> <li><a href=/example/a>ABC</a></li>
I have the following HTML: </td><td> <div id=arrow></div> </td> <form method=POST action=index.php> <input type=hidden
I am using jQuery Tools v1.2.7 and jQuery v1.7.2. I have the following code:
I have the following jquery script: $(function(){ $('#top-menu').on('click', 'a.change-menu', function(e){ e.preventDefault() $(#menu-change-div).load($(this).attr(href)); }); });
I have the following jquery code: $(document).ready(function() { $(body[class*=page-calendar-practices] #content-header h1#title).after(<div id='athletics_practice-schedule'><div id='inner-title'><a href='www.example.com'
I have the following jQuery $.ajax({ type: GET, url: http://f.cl.ly/items/0i1V1L1k2F440L1m2Y0G/pointdata.xml, dataType: xml, success: parseXml
I have this following jquery text fly-in animation.Here is my code before I explain
I have the following bit of jQuery for adding a clear button to the
I am using jquery tools date input . In my application i have a
I have added Facebook's like button inside the first tab of a JQuery Tools'

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.