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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:03:07+00:00 2026-06-10T16:03:07+00:00

I have a .blur() event for four text inputs, that has datepicker and timepicker

  • 0

I have a .blur() event for four text inputs, that has datepicker and timepicker attached to them. When i “tab” to the next control, it works fine, but when i click somewhere outside, the event does not trigger. Am I doing something wrong, or is there a problem with the .blur() event?

JavasSript code for the event:

    $(".calcTimespan").blur(function () {
        $.ajax({
            type: "GET",
            url: '@Url.Action("CalculateTimespan")',
            data: {
                "franDatum": $("#Dyk_FranDatum").val(),
                "franTid": $("#Dyk_FranTid").val(),
                "tillDatum": $("#Dyk_TillDatum").val(),
                "tillTid": $("#Dyk_TillTid").val()
            },
            dataType: 'html',
            cache: false,
            success: function (data) {
                if (data != "FAIL")
                    $("#Dyk_DyktidMinuter").val(data);
            },
            error: function (jqXHR, textStatus, errorThrown) {
                alert("Ett fel inträffade vid hämtning av dykning!");
            }
        });
    });

The HTML:

    <div>
        <label for="Fr_n_datum">Fr&#229;n datum</label>
        <label style="margin-left: 40px;">Tid</label>
        <br />
        <input class="halv datumpicker calcTimespan" id="Dyk_FranDatum" name="Dyk.FranDatum" type="text" value="" />
        <input class="halv tidpicker calcTimespan" id="Dyk_FranTid" name="Dyk.FranTid" type="text" value="" />
    </div>
    <br />

    <div>
        <label for="Till_datum">Till datum</label>
        <label style="margin-left: 50px;">Tid</label>
        <br />
        <input class="halv datumpicker calcTimespan" id="Dyk_TillDatum" name="Dyk.TillDatum" type="text" value="" />
        <input class="halv tidpicker calcTimespan" id="Dyk_TillTid" name="Dyk.TillTid" type="text" value="" />
    </div>
    <br />

    <div>
        <label for="Dyktim__min_">Dyktim (min)</label>
        <label style="margin-left: 33px;">Pris per minut</label>
        <br />
        <input class="halv" id="Dyk_DyktidMinuter" name="Dyk_DyktidMinuter" type="text" value="" />
        <input class="halv" id="Dyk_Pris" name="Dyk.Pris" type="text" value="" />
    </div>

I’m targeting IE9 only.

EDIT
It seems that the events are working fine. The problem is that when I’m clicking in the datepicker to select a date, already at the mouse-down on the date, the event is triggered, even though the value is not already set by the component in the input-text!

Now, I have to find a way to either get the “mouse down”-date or delay the event to when it’s actually set in the input-text.

  • 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-10T16:03:09+00:00Added an answer on June 10, 2026 at 4:03 pm

    The issue I was actually having was this: jqueryUI datepicker fires input's blur before passing date, avoid/workaround?

    I used a variant of Purells answer to solve my problem.

    Thanks for all support. It was the help in this question that led me to the real problem.

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

Sidebar

Related Questions

I have a standard text input that has a blur event. The blur event
I have some code bound to the blur() event in jQuery: $('input[type=text]').blur(function () {
I have text input element and an event is fired on blur event and
I have some validation on a text input bound to its blur event. I
I have the following JQuery function being attached to the blur event of n
I want to observe other field blur event. Suppose I have: <input type=text name=age
I have a JQuery validation files that look as follow: $('#TextBoxRisultati2b').on('blur', function () {
$('.searchbox').blur(function() { $(#gohan).hide(); }); $('.dropdown').blur(function() { $(#gohan).hide(); }); Hi, I have a searchbox that
I have a text box for searching. For some reason, .blur() will not work
document.getElementById(Iframe_id).contentWindow.addEventListener(blur, blurtest, true); By using this line I have given the blur event 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.