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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:07:27+00:00 2026-05-28T05:07:27+00:00

I had just started using $.on() for a dynamical table for collect passenger personal

  • 0

I had just started using $.on() for a dynamical table for collect passenger personal data.
This is the typical that you have to hit an add button to add a new row at the end of the table for more passengers.

I have to validate the child ID (RUT) it’s works great, but when the validation fails I show an alert, to tell the user that the data is incorrect so, first time it looks ok, but if the user fails again, it shows 2 alerts, then 3,4,… and so on as the user continues his struggle for enter an invalid ID.

I would be very happy if anyone can help, to correct this behavior achieving show only one alert per fails. Clicking “ok” five times is very annoying, and could be a reason for the project to be left behind.

This is the code I use:

    $("#tabdata").on("focus",".rut",function(){
    $(this).css("border","1px solid lightSkyBlue");
    });
$("#tabdata").on("focus",".rut",function(){
    $(this).blur(function(e){   
        var rut = $(this).val();
        var rutarr = rut.split("-");
        if (rutarr.length==1 || dv(rutarr[0].toLowerCase())!=rutarr[1].toLowerCase()){
        //ver si el rut esta mal escrito, sin guion split no separara nada.
        $(this).css("border","1px solid Red");
        alert("EPA!!!, no tan rapido, el Rut ingresado no es valido, por favor revisa bien.");

        }else{
        $(this).css("border","1px solid Green");

        }
    });
});

and here is the page for you to see this epic fail of mine.

  • 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-05-28T05:07:27+00:00Added an answer on May 28, 2026 at 5:07 am

    This is happening because you are binding an event handler within another event handler. Each time a .rut element is focused another blur event handler is attached to the element. Remove the blur event hanler from the focus event handler and all will be well:

    $("#tabdata").on("focus",".rut",function(){
        $(this).css("border","1px solid lightSkyBlue");
    }).on("blur",".rut", function(e){   
        var rut    = $(this).val(),
            rutarr = rut.split("-");
        if (rutarr.length == 1 || dv(rutarr[0].toLowerCase()) != rutarr[1].toLowerCase()){
        //ver si el rut esta mal escrito, sin guion split no separara nada.
            $(this).css("border","1px solid Red");
            alert("EPA!!!, no tan rapido, el Rut ingresado no es valido, por favor revisa bien.");
    
        } else {
            $(this).css("border","1px solid Green");
    
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just started using Git and I love it, but I have had an
I've just started using Code Contracts with .NET and I had a guard clause
I have not used PackedArray before, but just started looking at using them from
I just started using the jquery swfupload plugin and I have everything working besides
I have just started using JSON... I am using it in my project (Spring).
I have an issue at work where we have just started using scrum as
We have recently started using git and had a nasty problem when someone committed
I just started using Active Admin Gem. I have a little bit of a
I'm hoping this isn't too dumb a question: I just started using MVVM light
I've just started learning C# and had created this simple configuration file generator for

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.