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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:43:23+00:00 2026-06-15T10:43:23+00:00

$(document).ready(function () { $.validator.setDefaults({ submitHandler: function () { $(‘#search’).submit(function () { var city =

  • 0
$(document).ready(function () {
$.validator.setDefaults({
    submitHandler: function () {
        $('#search').submit(function () {
            var city = $("#city").val();
            var adults = $("#adults").val();
            var children = $("#children").val();
            var SDate = $("#hotelStartDate").val();
            var EDate = $("#hotelEndDate").val();
            SDate = SDate.substr(6, 4) + '-' + SDate.substr(3, 2) + '-' + SDate.substr(0, 2);
            EDate = EDate.substr(6, 4) + '-' + EDate.substr(3, 2) + '-' + EDate.substr(0, 2);
            jQuery(":submit", this).css("display", "none");
            jQuery(":submit", this).after("<span class='button nice awesome green large radius'>Searching...</span>");
            location.href = 'http://www.dhitrax.com/destination.php?checkin=' + SDate + '&checkout=' + EDate + '&city=' + city + '&adults=' + adults + '&children=' + children;
            return false;
        });
    },
    highlight: function (input) {
        $(input).addClass("ui-state-highlight");
    },
    unhighlight: function (input) {
        $(input).removeClass("ui-state-highlight");
    }
});
$().ready(function () {
    $.fn.themeswitcher && $('<div/>').css({
        position: "absolute",
        right: 10,
        top: 10
    }).appendTo(document.body).themeswitcher();
    $("#search").validate({
        rules: {
            city: "required",
            hotelStartDate: "required",
            hotelEndDate: "required"
        },
        messages: {
            City: "Please type your destination",
            hotelStartDate: "Select check in Date",
            hotelEndDate: "Select check out Date"
        }
    });
});
});
  • 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-15T10:43:24+00:00Added an answer on June 15, 2026 at 10:43 am

    You shouldn’t bind an event handler to the submit event inside of the existing submitHandler jQuery validate provides. It’s taking two clicks to submit the form because the first time you submit, the handler is bound and the second time you submit the handler is executed.

    This should be as simple as moving your code into the submitHandler:

    $.validator.setDefaults({
        submitHandler: function () {
            var city = $("#city").val();
            var adults = $("#adults").val();
            var children = $("#children").val();
            var SDate = $("#hotelStartDate").val();
            var EDate = $("#hotelEndDate").val();
            SDate = SDate.substr(6, 4) + '-' + SDate.substr(3, 2) + '-' + SDate.substr(0, 2);
            EDate = EDate.substr(6, 4) + '-' + EDate.substr(3, 2) + '-' + EDate.substr(0, 2);
            jQuery(":submit", this).css("display", "none");
            jQuery(":submit", this).after("<span class='button nice awesome green large radius'>Searching...</span>");
            location.href = 'http://www.dhitrax.com/destination.php?checkin=' + SDate + '&checkout=' + EDate + '&city=' + city + '&adults=' + adults + '&children=' + children;
        },
        highlight: function (input) {
            $(input).addClass("ui-state-highlight");
        },
        unhighlight: function (input) {
            $(input).removeClass("ui-state-highlight");
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got the rules defined below for a page: $(document).ready(function() { $.validator.setDefaults({ submitHandler :
What wrong with this validation: Jquery: $(document).ready(function(){ $(#addcmd).attr(disabled,disabled); $(#cmdstxt).keypress( function(event){ var txt=$(#cmdstxt); if( txt.val().length
$(document).ready(function() { function countChecked() { var n = $(input:checked).length; $(div).text(n + (n <= 1
I have some problems to run the following code, the js: $(document).ready(function(){ $.validator.addMethod(name, function(value,
I have the following code: $(document).ready ( function () { $.validator.addMethod( lessThan, function (value,
Hopefully a simple issue: $(document).ready(function(){ $(#regform).validate({ errorPlacement: function (error, element) { $(element).parent().next().next().hide(); //works $(element).parent().next('div.test').hide();
I have the following code to enable validation work: $(document).ready(function() { $(#eventForm).validate({ rules: {
i am using a jquery validation in form my code is following Jquery $(document).ready(function
$(document).ready(function () { $('#keywordframe').contents().find(#step12).html(''); $('#keywordframe').contents().find(#step12).html('11'); $('#keywordframe').contents().find(#step13).html(''); $('#keywordframe').contents().find(#step13).html('12'); $('#keywordframe').contents().find(#step14).html(''); $('#keywordframe').contents().find(#step14).html('13'); $('#keywordframe').contents().find(#step15).html(''); $('#keywordframe').contents().find(#step15).html('14'); }); I try
$(document).ready(function() { chart1 = new Highcharts.Chart({ chart: { renderTo: 'QueryResultsChart', type: 'bar' }, title:

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.