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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:23:30+00:00 2026-05-26T09:23:30+00:00

I am having a slight problem with this piece of code as I am

  • 0

I am having a slight problem with this piece of code as I am not very good with JavaScript. For some reason, I have messed around with the syntax and because I am using Visual Studio 2010, there is not really a way to debug the JavaScript. I’m not sure what I have done wrong, but when I try and launch this piece of code in a browser, it appears to just keep on loading, and doesn’t actually finish. I am wondering if there is something wrong with my expressions, but either way I have been working on this for quite a few days and it is starting to frustrate me.

Any answers will be highly appreciated.

var addAbsence = {
holDayCount: 0,

init: function () {
    var deferrend = $.Deferred();

    $("#addAbsence select[name=type]").change(function () {
        switch ($(this).val()) {
            case "0": case "1":
                $("#addAbsence .borderWrap.type").animate({ "width": 266 }, 300, "swing", function () {
                    $("#addAbsence .borderWrap.tInfo").show();
                });
                $("#addAbsence .halfDays").show();
                $("#addAbsence .lateArrivalTime").hide();
                $("#addAbsence .paidHolidayCount").show();
                break;
            case "2":
                $("#addAbsence .borderWrap.type").animate({ "width": 266 }, 300, "swing", function () {
                    $("#addAbsence .borderWrap.tInfo").show();
                });
                $("#addAbsence .halfDays").hide();
                $("#addAbsence .paidHolidayCount").hide();
                $("#addAbsence .lateArrivalTime").show();
                break;
            default:
                $("#addAbsence .borderWrap.tInfo").hide();
                $("#addAbsence .halfDays").hide();
                $("#addAbsence .borderWrap.type").animate({ "width": 554 }, 300, "swing");
        }
    });

    $("#addAbsence input.date").datepicker({
        "dateFormat": "DD, d MM, yy",
        onSelect: function () {
            var dateFrom = Date.parse($("#addAbsence input[name=dateFrom]").val());
            var dateTo = Date.parse($("#addAbsence input[name=dateTo]").val());

            if (!isNaN(dateFrom) && !isNaN(dateTo)) {
                var dates = addAbsence.getStartEndDate();

                if ((dateFrom <= dateTo) &&
                    (dateFrom >= dates.dateFrom && dates.dateFrom <= dateTo) &&
                    (dateFrom <= dates.dateTo && dates.dateTo >= dateTo)) {

                    $("#addAbsence input[name=dateFrom], #addAbsence input[name=dateTo]").removeClass("error");

                    if ($("#addAbsence select[name=type]").val() == "0") {
                        addAbsence.calcDayCount();

                        $("#addAbsence p.holUsing").html(addAbsence.holDayCount);
                    }
                    else {
                        $("#addAbsence p.holUsing").html("0");
                    }
                }
                else {
                    $("#addAbsence input[name=dateFrom], #addAbsence input[name=dateTo]").addClass("error");

                    $("#addAbsence p.holUsing").html("--");
                }
            }
            else {
                $("#addAbsence input[name=dateFrom], #addAbsence input[name=dateTo]").removeClass("error");
            }
        }
    });

    $("#addAbsence .addHalfDay").click(function () {
        addAbsence.calcDayCount();

        if ($("#addAbsence input[name=dateFrom]").val().length > 0 && $("#addAbsence input[name=dateTo]").val().length > 0 &&
            Date.parse($("#addAbsence input[name=dateFrom]").val()) <= Date.parse($("#addAbsence input[name=dateTo]").val())) {

            $("#addAbsence input[name=dateFrom], #addAbsence input[name=dateTo]").removeClass("error");

            if ($("#addAbsence tbody tr").size() < addAbsence.holDayCount) {
                addAbsence.addHalfDay();
            }
        }
        else {
            $("#addAbsence input[name=dateFrom], #addAbsence input[name=dateTo]").addClass("error");

    $("#addAbsence select[name=type]").change();
    )};


    $("form#addAbsence").submit(function () {
        var boolDate = $(this).find("input[name=dateFrom]").dateRangeValid($(this).find("input[name=dateTo]"));
        var boolComments = $(this).find("textarea[name=comments]").lengthValid(0, 350);
        var boolAbsenceType = $(this).find("select[name=type]").selectValid(1);

       )};
  • 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-26T09:23:31+00:00Added an answer on May 26, 2026 at 9:23 am

    You have two nesting errors to the bottom of your code. I don’t know if that’s it though. Here’s the fixed code:

    $("#addAbsence select[name=type]").change(function () {
        switch ($(this).val()) {
            case "0": case "1":
                $("#addAbsence .borderWrap.type").animate({ "width": 266 }, 300, "swing", function () {
                    $("#addAbsence .borderWrap.tInfo").show();
                });
                $("#addAbsence .halfDays").show();
                $("#addAbsence .lateArrivalTime").hide();
                $("#addAbsence .paidHolidayCount").show();
                break;
            case "2":
                $("#addAbsence .borderWrap.type").animate({ "width": 266 }, 300, "swing", function () {
                    $("#addAbsence .borderWrap.tInfo").show();
                });
                $("#addAbsence .halfDays").hide();
                $("#addAbsence .paidHolidayCount").hide();
                $("#addAbsence .lateArrivalTime").show();
                break;
            default:
                $("#addAbsence .borderWrap.tInfo").hide();
                $("#addAbsence .halfDays").hide();
                $("#addAbsence .borderWrap.type").animate({ "width": 554 }, 300, "swing");
        }
    });
    
    $("#addAbsence input.date").datepicker({
        "dateFormat": "DD, d MM, yy",
        onSelect: function () {
            var dateFrom = Date.parse($("#addAbsence input[name=dateFrom]").val());
            var dateTo = Date.parse($("#addAbsence input[name=dateTo]").val());
    
            if (!isNaN(dateFrom) && !isNaN(dateTo)) {
                var dates = addAbsence.getStartEndDate();
    
                if ((dateFrom <= dateTo) &&
                    (dateFrom >= dates.dateFrom && dates.dateFrom <= dateTo) &&
                    (dateFrom <= dates.dateTo && dates.dateTo >= dateTo)) {
    
                    $("#addAbsence input[name=dateFrom], #addAbsence input[name=dateTo]").removeClass("error");
    
                    if ($("#addAbsence select[name=type]").val() == "0") {
                        addAbsence.calcDayCount();
    
                        $("#addAbsence p.holUsing").html(addAbsence.holDayCount);
                    }
                    else {
                        $("#addAbsence p.holUsing").html("0");
                    }
                }
                else {
                    $("#addAbsence input[name=dateFrom], #addAbsence input[name=dateTo]").addClass("error");
    
                    $("#addAbsence p.holUsing").html("--");
                }
            }
            else {
                $("#addAbsence input[name=dateFrom], #addAbsence input[name=dateTo]").removeClass("error");
            }
        }
    });
    
    $("#addAbsence .addHalfDay").click(function () {
        addAbsence.calcDayCount();
    
        if ($("#addAbsence input[name=dateFrom]").val().length > 0 && $("#addAbsence input[name=dateTo]").val().length > 0 &&
            Date.parse($("#addAbsence input[name=dateFrom]").val()) <= Date.parse($("#addAbsence input[name=dateTo]").val())) {
    
            $("#addAbsence input[name=dateFrom], #addAbsence input[name=dateTo]").removeClass("error");
    
            if ($("#addAbsence tbody tr").size() < addAbsence.holDayCount) {
                addAbsence.addHalfDay();
            }
        }
        else {
            $("#addAbsence input[name=dateFrom], #addAbsence input[name=dateTo]").addClass("error");
        }
    
        $("#addAbsence select[name=type]").change();
    });
    
    
    $("form#addAbsence").submit(function () {
        var boolDate = $(this).find("input[name=dateFrom]").dateRangeValid($(this).find("input[name=dateTo]"));
        var boolComments = $(this).find("textarea[name=comments]").lengthValid(0, 350);
        var boolAbsenceType = $(this).find("select[name=type]").selectValid(1);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a slight problem. I have set my <input type=file> to onChange=this.form.submit() .
I am coding this layout as a wordpress theme and having a slight problem
I'm having a slight problem with my SDL/Opengl code, specifically, when i try to
I have a slight problem. Having recently migrated on Mac, I've been pulling my
I am having some slight difficulty with the following code: Lagrange[list_] := Module[{points =
I am having som slight difficulties with the following problem. I have initialized a
Having a problem getting a TreeView control to display node images. The code below
I'm having a slight problem that I can't figure out, but should be really
UPDATE : look at the demo here: http://amit-verma.com/template_test/ i am having a slight problem
I am having a slight problem. I believe that my Netbeans is set 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.