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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:20:24+00:00 2026-06-05T10:20:24+00:00

I am trying to get the buttontext of datepicker (which defaults to an ellipsis),

  • 0

I am trying to get the buttontext of datepicker (which defaults to an ellipsis), to set itself as the value of the input.

I have multiple datepickers on the page, and unlike my example below I have an icon instead of a text input. I would like the value itself to show on the tooltip that appears when you hover over the icon.

I have tried – buttonText: $(this).val() as an option but it doesn’t pick anything up

Example – http://jsbin.com/unolot/3/

So my question – How do I get the buttontext of the datepicker input to match the value dynamically?

  • 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-05T10:20:26+00:00Added an answer on June 5, 2026 at 10:20 am

    You have to handle two cases:

    • When the selected date changes: use the onSelect event to change the button’s title attribute
    • On initial rendering: unfortunately, the datepicker does not implement the widget factory (yet) so there is no create event, you’ll have to update the title attribute manually after the widget has initialized.

    Don’t forget to set the default date of the picker to the initial value of the field, otherwise the default selected date is “today”

    Something like this:

    // as you have several instances, loops through them
    $(".deadline_picker_on").each(function() {
    
        var dt = $(this);
    
        dt.datepicker({
            showOn: "button",
            buttonText: '',
            // set the default date to the value of the field
            defaultDate: dt.val(),
            duration: 100,
            dateFormat: 'yy-mm-dd',
            showOptions: {
                direction: 'right'
            },
            onSelect: function(dateText, inst) {
                // on data selection, change the title attribute of the button
                $(this).next().attr('title', dateText);
            }
        })
        // get the button (next element)
        .next()
        // set the title attribute with the formatted initial date from the picker
        .attr('title', $.datepicker.formatDate('yy-mm-dd', dt.datepicker('getDate')));
    });
    ​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So i am trying get 2 div-containers which both should contain centered text (Both
I'm trying get the address of GetProcAddress with GetProcAddress (yes. calling it on itself).
I am trying to get the value of an EditText in my CustomView, but
I'm trying something simple, just to get the text value inside a p:inputText thought
I have been breaking my head trying to get this working but I can't
I am trying get my first simple project in rails to run. I have
I am trying get tree view in the web page. I am using jstree
I am trying get the Regex right for the following scenario but have some
I'm trying get the code below to always highlight the current page of a
I'm trying get the visible portion of UIImage from an UIImageView . UIImageView takes

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.