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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:41:55+00:00 2026-05-22T00:41:55+00:00

The jquery datepicker plugin works, but I’d like to have onSelect triggering a function

  • 0

The jquery datepicker plugin works, but I’d like to have onSelect triggering a function which opens a page in a new tab.

The jquery datepicker plugin works, but I’d like to have onSelect triggering a function which opens a page in a new tab.

$("#dp").datepicker({
beforeShowDay: highlightDays,

//works perfectly fine

onSelect: function(dates) { window.open('/en/calendar/' + dates, '_self'); },
});

var dates = [new Date(2011, 4 - 1, 28), new Date(2011, 5 - 1, 10),];

//does not work

onSelect: function(links) { window.open('/en/trip/' + links, '_self'); },

var links = [new Link('link1'), new Link('link2'),];

the js:

$( "#toggleDP" ).click(function() { $("#dp ").datepicker('show'); });

$("#dp").datepicker({
changeMonth: true,
changeYear: true,
showOn: 'button',
showButtonPanel: true,
buttonImageOnly: true,
buttonImage: "0.gif",
dateFormat: 'yy-mm-dd',
beforeShowDay: highlightDays,
onSelect: function(dates) { window.open('/en/calendar/' + dates, '_self'); },
});


var links =[new Link('test'), new Link('test1'), ];
var dates = [new Date(2011, 4 - 1, 28), new Date(2011, 5 - 1, 10), ];
var txt = ['test','test1',];

function highlightDays(date) {
for (var i = 0; i < dates.length; i++) {
if (dates[i]-date==0) {
return [true, 'markedDay', txt[i],];
}
}
return [false, ''];
}

if i were to set onSelect to function(links) { window.open(‘/en/trips/’ + links, ‘_self’); }, then for some unknown reasons, it opens an URL with the corresponding DATE not with the corresponding link.

  • 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-22T00:41:56+00:00Added an answer on May 22, 2026 at 12:41 am

    Here is the onSelect handler syntax:

    function(dateText, inst)
    

    And explanation from the docs:

    The function receives the selected
    date as text and the datepicker
    instance as parameters.

    So when you say:

       onSelect: function(links) { window.open('/en/trips/' + links, '_self'); }
    

    So passing as a parameter links is not actually the array you think it is but inside the handler the context is changed. i.e. links refers to the selected date as mentioned above.

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

Sidebar

Related Questions

I have been trying to make jquery datepicker plugin work on a content page
I have a jQuery datepicker that I want to restrict non work days -
Jquery has a great language construct that looks like this: $(document).ready(function() { $(a).click(function() {
I am currently using the JQuery plugin Datepicker in my Symfony project with the
I'm using the jQuery datepicker to select dates. It works fine, except there is
well im using this script right here: http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/ and I have a multiMonth plugin
I'm using the JQuery DatePicker to have the user pick a date and have
I am using jQuery Datepicker and I have a little problem. If the datepicker
We've built an AJAX website which uses JQuery UI extensively. we have 30+ homemade
We have an instance of the jQuery UI DatePicker. When the built in validation

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.