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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:45:25+00:00 2026-06-12T08:45:25+00:00

I am trying to make a button change the text or value of my

  • 0

I am trying to make a button change the text or value of my datebox form. The value will change if I call $(“element”).val(“value-date”) but the form that contains the datebox will not change its text to the value-date. I have refreshed the datebox and that has not worked.
Here is my code

HTML:

<div class='container center' style='margin-top:15%; margin-bottom:15%; width:90%; margin-right:auto; margin-left:auto;'>
        <input placeholder="Enter Date" id='comp_date' type='date' data-role='datebox' name='date' data-options='{"mode": "callbox","useTodayButton":true}'/>
        <a data-role="button" id='pick_today' href="#"  data-theme='e' class="reg_button" style="padding:15px; color:black; margin-bottom:50px;">Now</a>
</div>

Javascript:

     $("#pick_today").live("vclick",function()
     {
          var today = new Date();
          var month = today.getMonth();
          var day = today.getDate();
          var year = today.getFullYear();
          var todayText = year + "-" + month + "-" day;
          $("#comp_date").val(todayText);
          $("#comp_date").datebox("refresh");
     }
  • 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-12T08:45:26+00:00Added an answer on June 12, 2026 at 8:45 am

    After a long time spent on this issue, finally got and fixed your problem.

    Your code issues are:

    1. Symbol "+" is missing on this line

      var todayText = year + "-" + month + "-" + day;

    2. On the input tag, mode is calbox not callbox

      data-options='{"mode": "calbox"

    3. Month calculation should be +1. Since January starts with Zero (0)

      var month = today.getMonth()+1;

    JQuery:

    $("#pick_today").live("click", function() {
        var today = new Date();
        var month = today.getMonth()+1;
        var day = today.getDate();
        var year = today.getFullYear();
        var todayText = year + "-" + month + "-" + day;
        $("#comp_date").val(todayText);
    });
    

    HTML:

    <div class='container center' style='margin-top:15%; margin-bottom:15%; width:90%; margin-right:auto; margin-left:auto;'>
        <input placeholder="Enter Date" id='comp_date' type='date' data-role='datebox' name='date' data-options='{"mode": "calbox","useTodayButton":true}'/>
        <a data-role="button" id='pick_today' href="#"  data-theme='e' class="reg_button" style="padding:15px; color:black; margin-bottom:50px;">Now</a>
    </div>​
    

    USED CSS & JS:

    http://jquerymobile.com/demos/1.0rc3/jquery.mobile-1.0rc3.min.css
    http://jquerymobile.com/demos/1.0rc3/jquery.mobile-1.0rc3.min.js
    http://dev.jtsage.com/cdn/datebox/latest/jquery.mobile.datebox.min.css
    http://dev.jtsage.com/cdn/datebox/latest/jquery.mobile.datebox.min.js
    

    Refer my LIVE DEMO

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

Sidebar

Related Questions

I'm trying to make a form that will take given text and direct you
I'm trying to make a simple JQuery button from a div which will change
I'm trying to make iPhone-style EditText element on android. The one that will have
I am trying to make a button for the user where he will be
I am trying to make this button using CSS3: But my button looks like
I'm trying to make a button for my form which has an image background
Trying to make a toggle button that hides/shows the right window/pane. Here is a
Here is some code that I'm trying to make save some UITextView text. When
I'm trying make a static text which if too long for the sizer, will
I am trying to make an application that will have a set of screens

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.